direction : rtl doesn't work with angular material cards?












0















I'm using angular material cards and want to make text start from right to left , so i used direction: rtl; but it wasn't work .
any help ?
HTML Code :



<mat-card class="example-card">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
<mat-card-title>
<button class="profilrButton" (click)="viewProfile(post.uid)">{{post.fullName}}</button>
</mat-card-title>
<mat-card-subtitle>
<p wrapper>{{post.title}} </p>
</mat-card-subtitle>
<mat-card-subtitle style="float: right;font-size: 8pt">{{arr[ind]['date']}}</mat-card-subtitle>
</mat-card-header>

<img mat-card-image src={{post.imageURL}} alt="Photo of a Shiba Inu">
<mat-card-content>
<p [class]="(hasArabic(post.description))? 'pre rtl':'pre'">
{{post.description}}
</p>
</mat-card-content>
<mat-card-actions>
<button class="classA" (click)="approve(post.key,ind)" mat-button>Accept</button>
<button class="classR" (click)="delete(post.key,ind)" mat-button>Reject</button>
</mat-card-actions>
</mat-card>


CSS



.pre{
white-space: pre-line;
}
.rtl{
direction: rtl;
}









share|improve this question





























    0















    I'm using angular material cards and want to make text start from right to left , so i used direction: rtl; but it wasn't work .
    any help ?
    HTML Code :



    <mat-card class="example-card">
    <mat-card-header>
    <div mat-card-avatar class="example-header-image"></div>
    <mat-card-title>
    <button class="profilrButton" (click)="viewProfile(post.uid)">{{post.fullName}}</button>
    </mat-card-title>
    <mat-card-subtitle>
    <p wrapper>{{post.title}} </p>
    </mat-card-subtitle>
    <mat-card-subtitle style="float: right;font-size: 8pt">{{arr[ind]['date']}}</mat-card-subtitle>
    </mat-card-header>

    <img mat-card-image src={{post.imageURL}} alt="Photo of a Shiba Inu">
    <mat-card-content>
    <p [class]="(hasArabic(post.description))? 'pre rtl':'pre'">
    {{post.description}}
    </p>
    </mat-card-content>
    <mat-card-actions>
    <button class="classA" (click)="approve(post.key,ind)" mat-button>Accept</button>
    <button class="classR" (click)="delete(post.key,ind)" mat-button>Reject</button>
    </mat-card-actions>
    </mat-card>


    CSS



    .pre{
    white-space: pre-line;
    }
    .rtl{
    direction: rtl;
    }









    share|improve this question



























      0












      0








      0








      I'm using angular material cards and want to make text start from right to left , so i used direction: rtl; but it wasn't work .
      any help ?
      HTML Code :



      <mat-card class="example-card">
      <mat-card-header>
      <div mat-card-avatar class="example-header-image"></div>
      <mat-card-title>
      <button class="profilrButton" (click)="viewProfile(post.uid)">{{post.fullName}}</button>
      </mat-card-title>
      <mat-card-subtitle>
      <p wrapper>{{post.title}} </p>
      </mat-card-subtitle>
      <mat-card-subtitle style="float: right;font-size: 8pt">{{arr[ind]['date']}}</mat-card-subtitle>
      </mat-card-header>

      <img mat-card-image src={{post.imageURL}} alt="Photo of a Shiba Inu">
      <mat-card-content>
      <p [class]="(hasArabic(post.description))? 'pre rtl':'pre'">
      {{post.description}}
      </p>
      </mat-card-content>
      <mat-card-actions>
      <button class="classA" (click)="approve(post.key,ind)" mat-button>Accept</button>
      <button class="classR" (click)="delete(post.key,ind)" mat-button>Reject</button>
      </mat-card-actions>
      </mat-card>


      CSS



      .pre{
      white-space: pre-line;
      }
      .rtl{
      direction: rtl;
      }









      share|improve this question
















      I'm using angular material cards and want to make text start from right to left , so i used direction: rtl; but it wasn't work .
      any help ?
      HTML Code :



      <mat-card class="example-card">
      <mat-card-header>
      <div mat-card-avatar class="example-header-image"></div>
      <mat-card-title>
      <button class="profilrButton" (click)="viewProfile(post.uid)">{{post.fullName}}</button>
      </mat-card-title>
      <mat-card-subtitle>
      <p wrapper>{{post.title}} </p>
      </mat-card-subtitle>
      <mat-card-subtitle style="float: right;font-size: 8pt">{{arr[ind]['date']}}</mat-card-subtitle>
      </mat-card-header>

      <img mat-card-image src={{post.imageURL}} alt="Photo of a Shiba Inu">
      <mat-card-content>
      <p [class]="(hasArabic(post.description))? 'pre rtl':'pre'">
      {{post.description}}
      </p>
      </mat-card-content>
      <mat-card-actions>
      <button class="classA" (click)="approve(post.key,ind)" mat-button>Accept</button>
      <button class="classR" (click)="delete(post.key,ind)" mat-button>Reject</button>
      </mat-card-actions>
      </mat-card>


      CSS



      .pre{
      white-space: pre-line;
      }
      .rtl{
      direction: rtl;
      }






      css angular angular-material2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 13:55









      t3__rry

      1,83711126




      1,83711126










      asked Nov 22 '18 at 13:43









      ahmedzakariaghanmahmedzakariaghanm

      11




      11
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I believe Material uses the dir attribute more than the direction style. Try:



            <mat-card-content>
          <p [dir]="(hasArabic(post.description)) ? 'rtl' : 'auto'" class="pre">
          {{post.description}}
          </p>
          </mat-card-content>


          You may also want to read up on the bidirectionality module but I think that is more for your own custom components that are used by Material components.






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432324%2fdirection-rtl-doesnt-work-with-angular-material-cards%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I believe Material uses the dir attribute more than the direction style. Try:



              <mat-card-content>
            <p [dir]="(hasArabic(post.description)) ? 'rtl' : 'auto'" class="pre">
            {{post.description}}
            </p>
            </mat-card-content>


            You may also want to read up on the bidirectionality module but I think that is more for your own custom components that are used by Material components.






            share|improve this answer






























              0














              I believe Material uses the dir attribute more than the direction style. Try:



                <mat-card-content>
              <p [dir]="(hasArabic(post.description)) ? 'rtl' : 'auto'" class="pre">
              {{post.description}}
              </p>
              </mat-card-content>


              You may also want to read up on the bidirectionality module but I think that is more for your own custom components that are used by Material components.






              share|improve this answer




























                0












                0








                0







                I believe Material uses the dir attribute more than the direction style. Try:



                  <mat-card-content>
                <p [dir]="(hasArabic(post.description)) ? 'rtl' : 'auto'" class="pre">
                {{post.description}}
                </p>
                </mat-card-content>


                You may also want to read up on the bidirectionality module but I think that is more for your own custom components that are used by Material components.






                share|improve this answer















                I believe Material uses the dir attribute more than the direction style. Try:



                  <mat-card-content>
                <p [dir]="(hasArabic(post.description)) ? 'rtl' : 'auto'" class="pre">
                {{post.description}}
                </p>
                </mat-card-content>


                You may also want to read up on the bidirectionality module but I think that is more for your own custom components that are used by Material components.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 22 '18 at 18:19

























                answered Nov 22 '18 at 17:44









                PacePace

                22.8k676100




                22.8k676100
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432324%2fdirection-rtl-doesnt-work-with-angular-material-cards%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    MongoDB - Not Authorized To Execute Command

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

                    Npm cannot find a required file even through it is in the searched directory