I would like to insert a text using the dir=auto directive and either read the same text that I insert into the database, or reuse the same dir=auto directive to display the text correctly.
I insert text into db using textarea and dir directive to detect direction automatically :
<textarea dir="auto" [(ngModel)]="Text"></textarea>
After loading from db, in ngOnInit() ts component i use bypassSecurityTrustHtml to get html :
Text = this.sanitizer.bypassSecurityTrustHtml(Text) as string;
Then i try to display it in html but text dosen't displayed same when inserted at first :
<p dir="auto" [innerHTML]="Text"></p>
After loading from db is always left to right
Any idea please.
the problem is dir="auto" will work for all text not for each paragraph, it's my remark, then solution i think is two split hole text into paragraphs and add style into each one
– itdev Oct 16 '22 at 15:14