Disable float for mdInput text field











up vote
3
down vote

favorite












In an Angular 4 (Material) app, I have a text field for search. When I type in the field, a second field appears showing the entered text. This new field floats as I scroll the page. How do I disable the floating behavior?



It doesn't seem to be default behavior for a text field. I've tried md-no-float, but that's for the placeholder text I understand. Someone suggested setting an empty value, so I added that, but the problem remains.



<md-input-container md-no-float style="width: 100%">
<input mdInput formControlName="search" value="" placeholder="Search Terms" />
</md-input-container>









share|improve this question
























  • @Vega I'm not sure I follow. There isn't any interpolation right there. The search input is actually displayed/enabled by a radio button and the next closest tag is the results in an ngFor div.
    – beachCode
    Sep 26 '17 at 6:06












  • You may mean the placeholder? material.angular.io/components/input/overview#placeholder
    – Vega
    Sep 26 '17 at 6:12












  • Can you provide a plunkr for the problem ?
    – Aakash Uniyal
    Sep 26 '17 at 6:40










  • I used your code and tried to simulate what you said but it looks fine. Are you talking about "Search terms" literal floating above the input field after you have entered something ?
    – Aakash Uniyal
    Sep 26 '17 at 6:44










  • @AakashUniyal, no it's the text I enter into the field--not the placeholder text. I'm just as confused. It's not standard behavior, so I'm trying to figure out what's causing it.
    – beachCode
    Sep 26 '17 at 6:46















up vote
3
down vote

favorite












In an Angular 4 (Material) app, I have a text field for search. When I type in the field, a second field appears showing the entered text. This new field floats as I scroll the page. How do I disable the floating behavior?



It doesn't seem to be default behavior for a text field. I've tried md-no-float, but that's for the placeholder text I understand. Someone suggested setting an empty value, so I added that, but the problem remains.



<md-input-container md-no-float style="width: 100%">
<input mdInput formControlName="search" value="" placeholder="Search Terms" />
</md-input-container>









share|improve this question
























  • @Vega I'm not sure I follow. There isn't any interpolation right there. The search input is actually displayed/enabled by a radio button and the next closest tag is the results in an ngFor div.
    – beachCode
    Sep 26 '17 at 6:06












  • You may mean the placeholder? material.angular.io/components/input/overview#placeholder
    – Vega
    Sep 26 '17 at 6:12












  • Can you provide a plunkr for the problem ?
    – Aakash Uniyal
    Sep 26 '17 at 6:40










  • I used your code and tried to simulate what you said but it looks fine. Are you talking about "Search terms" literal floating above the input field after you have entered something ?
    – Aakash Uniyal
    Sep 26 '17 at 6:44










  • @AakashUniyal, no it's the text I enter into the field--not the placeholder text. I'm just as confused. It's not standard behavior, so I'm trying to figure out what's causing it.
    – beachCode
    Sep 26 '17 at 6:46













up vote
3
down vote

favorite









up vote
3
down vote

favorite











In an Angular 4 (Material) app, I have a text field for search. When I type in the field, a second field appears showing the entered text. This new field floats as I scroll the page. How do I disable the floating behavior?



It doesn't seem to be default behavior for a text field. I've tried md-no-float, but that's for the placeholder text I understand. Someone suggested setting an empty value, so I added that, but the problem remains.



<md-input-container md-no-float style="width: 100%">
<input mdInput formControlName="search" value="" placeholder="Search Terms" />
</md-input-container>









share|improve this question















In an Angular 4 (Material) app, I have a text field for search. When I type in the field, a second field appears showing the entered text. This new field floats as I scroll the page. How do I disable the floating behavior?



It doesn't seem to be default behavior for a text field. I've tried md-no-float, but that's for the placeholder text I understand. Someone suggested setting an empty value, so I added that, but the problem remains.



<md-input-container md-no-float style="width: 100%">
<input mdInput formControlName="search" value="" placeholder="Search Terms" />
</md-input-container>






angular angular-material angular-material2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 26 '17 at 6:40

























asked Sep 26 '17 at 5:43









beachCode

66911128




66911128












  • @Vega I'm not sure I follow. There isn't any interpolation right there. The search input is actually displayed/enabled by a radio button and the next closest tag is the results in an ngFor div.
    – beachCode
    Sep 26 '17 at 6:06












  • You may mean the placeholder? material.angular.io/components/input/overview#placeholder
    – Vega
    Sep 26 '17 at 6:12












  • Can you provide a plunkr for the problem ?
    – Aakash Uniyal
    Sep 26 '17 at 6:40










  • I used your code and tried to simulate what you said but it looks fine. Are you talking about "Search terms" literal floating above the input field after you have entered something ?
    – Aakash Uniyal
    Sep 26 '17 at 6:44










  • @AakashUniyal, no it's the text I enter into the field--not the placeholder text. I'm just as confused. It's not standard behavior, so I'm trying to figure out what's causing it.
    – beachCode
    Sep 26 '17 at 6:46


















  • @Vega I'm not sure I follow. There isn't any interpolation right there. The search input is actually displayed/enabled by a radio button and the next closest tag is the results in an ngFor div.
    – beachCode
    Sep 26 '17 at 6:06












  • You may mean the placeholder? material.angular.io/components/input/overview#placeholder
    – Vega
    Sep 26 '17 at 6:12












  • Can you provide a plunkr for the problem ?
    – Aakash Uniyal
    Sep 26 '17 at 6:40










  • I used your code and tried to simulate what you said but it looks fine. Are you talking about "Search terms" literal floating above the input field after you have entered something ?
    – Aakash Uniyal
    Sep 26 '17 at 6:44










  • @AakashUniyal, no it's the text I enter into the field--not the placeholder text. I'm just as confused. It's not standard behavior, so I'm trying to figure out what's causing it.
    – beachCode
    Sep 26 '17 at 6:46
















@Vega I'm not sure I follow. There isn't any interpolation right there. The search input is actually displayed/enabled by a radio button and the next closest tag is the results in an ngFor div.
– beachCode
Sep 26 '17 at 6:06






@Vega I'm not sure I follow. There isn't any interpolation right there. The search input is actually displayed/enabled by a radio button and the next closest tag is the results in an ngFor div.
– beachCode
Sep 26 '17 at 6:06














You may mean the placeholder? material.angular.io/components/input/overview#placeholder
– Vega
Sep 26 '17 at 6:12






You may mean the placeholder? material.angular.io/components/input/overview#placeholder
– Vega
Sep 26 '17 at 6:12














Can you provide a plunkr for the problem ?
– Aakash Uniyal
Sep 26 '17 at 6:40




Can you provide a plunkr for the problem ?
– Aakash Uniyal
Sep 26 '17 at 6:40












I used your code and tried to simulate what you said but it looks fine. Are you talking about "Search terms" literal floating above the input field after you have entered something ?
– Aakash Uniyal
Sep 26 '17 at 6:44




I used your code and tried to simulate what you said but it looks fine. Are you talking about "Search terms" literal floating above the input field after you have entered something ?
– Aakash Uniyal
Sep 26 '17 at 6:44












@AakashUniyal, no it's the text I enter into the field--not the placeholder text. I'm just as confused. It's not standard behavior, so I'm trying to figure out what's causing it.
– beachCode
Sep 26 '17 at 6:46




@AakashUniyal, no it's the text I enter into the field--not the placeholder text. I'm just as confused. It's not standard behavior, so I'm trying to figure out what's causing it.
– beachCode
Sep 26 '17 at 6:46












4 Answers
4






active

oldest

votes

















up vote
10
down vote













<md-input-container [floatPlaceholder]="'never'">


this helped me to hide the floating placeholder



Edit: Since Angular Material 6



<mat-form-field floatPlaceholder="never">





share|improve this answer






























    up vote
    1
    down vote













    As per version 6.4.5 of @angular/material2 you can control floating labels using floatLabel input property as you can see in their floating label documentation.



    <mat-form-field [floatLabel]="'never'">





    share|improve this answer




























      up vote
      0
      down vote



      accepted










      It turns out it's the Chrome autocomplete popping up.



      If you add autocomplete="off" to both the form and the input field, it will go away.






      share|improve this answer




























        up vote
        0
        down vote













        Just remove placeholder attribute



        <input matInput placeholder="Input">


        to



        <input matInput >





        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',
          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%2f46418625%2fdisable-float-for-mdinput-text-field%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          10
          down vote













          <md-input-container [floatPlaceholder]="'never'">


          this helped me to hide the floating placeholder



          Edit: Since Angular Material 6



          <mat-form-field floatPlaceholder="never">





          share|improve this answer



























            up vote
            10
            down vote













            <md-input-container [floatPlaceholder]="'never'">


            this helped me to hide the floating placeholder



            Edit: Since Angular Material 6



            <mat-form-field floatPlaceholder="never">





            share|improve this answer

























              up vote
              10
              down vote










              up vote
              10
              down vote









              <md-input-container [floatPlaceholder]="'never'">


              this helped me to hide the floating placeholder



              Edit: Since Angular Material 6



              <mat-form-field floatPlaceholder="never">





              share|improve this answer














              <md-input-container [floatPlaceholder]="'never'">


              this helped me to hide the floating placeholder



              Edit: Since Angular Material 6



              <mat-form-field floatPlaceholder="never">






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jul 25 at 13:27

























              answered Sep 26 '17 at 11:38









              CodeNoob

              91188




              91188
























                  up vote
                  1
                  down vote













                  As per version 6.4.5 of @angular/material2 you can control floating labels using floatLabel input property as you can see in their floating label documentation.



                  <mat-form-field [floatLabel]="'never'">





                  share|improve this answer

























                    up vote
                    1
                    down vote













                    As per version 6.4.5 of @angular/material2 you can control floating labels using floatLabel input property as you can see in their floating label documentation.



                    <mat-form-field [floatLabel]="'never'">





                    share|improve this answer























                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      As per version 6.4.5 of @angular/material2 you can control floating labels using floatLabel input property as you can see in their floating label documentation.



                      <mat-form-field [floatLabel]="'never'">





                      share|improve this answer












                      As per version 6.4.5 of @angular/material2 you can control floating labels using floatLabel input property as you can see in their floating label documentation.



                      <mat-form-field [floatLabel]="'never'">






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Aug 15 at 4:56









                      j3ff

                      1,67911025




                      1,67911025






















                          up vote
                          0
                          down vote



                          accepted










                          It turns out it's the Chrome autocomplete popping up.



                          If you add autocomplete="off" to both the form and the input field, it will go away.






                          share|improve this answer

























                            up vote
                            0
                            down vote



                            accepted










                            It turns out it's the Chrome autocomplete popping up.



                            If you add autocomplete="off" to both the form and the input field, it will go away.






                            share|improve this answer























                              up vote
                              0
                              down vote



                              accepted







                              up vote
                              0
                              down vote



                              accepted






                              It turns out it's the Chrome autocomplete popping up.



                              If you add autocomplete="off" to both the form and the input field, it will go away.






                              share|improve this answer












                              It turns out it's the Chrome autocomplete popping up.



                              If you add autocomplete="off" to both the form and the input field, it will go away.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Sep 27 '17 at 16:30









                              beachCode

                              66911128




                              66911128






















                                  up vote
                                  0
                                  down vote













                                  Just remove placeholder attribute



                                  <input matInput placeholder="Input">


                                  to



                                  <input matInput >





                                  share|improve this answer

























                                    up vote
                                    0
                                    down vote













                                    Just remove placeholder attribute



                                    <input matInput placeholder="Input">


                                    to



                                    <input matInput >





                                    share|improve this answer























                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      Just remove placeholder attribute



                                      <input matInput placeholder="Input">


                                      to



                                      <input matInput >





                                      share|improve this answer












                                      Just remove placeholder attribute



                                      <input matInput placeholder="Input">


                                      to



                                      <input matInput >






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 5 at 2:18









                                      FlyingTurtle

                                      42111




                                      42111






























                                           

                                          draft saved


                                          draft discarded



















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46418625%2fdisable-float-for-mdinput-text-field%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest




















































































                                          這個網誌中的熱門文章

                                          Xamarin.form Move up view when keyboard appear

                                          Post-Redirect-Get with Spring WebFlux and Thymeleaf

                                          Anylogic : not able to use stopDelay()