Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS material layout - issues with flex

I have a problem setting the flex properties of my layout. Here is a plunker: http://embed.plnkr.co/0SrUp25FvT2PAsJDEwF3/preview

  <md-content flex layout="row" layout-align="center">
    <div layout="column">
      <div flex layout="column" layout-fill>
        <div flex="33">
          <md-input-container>
            <label>Enter Room's Name</label>
            <input ng-model="test" placeholder="Enter Room's Name">
          </md-input-container>
        </div>
        <div flex="66">
          <md-button class="md-raised md-accent">
            Create Chat Room
          </md-button>
        </div>
      </div>
    </div>
  </md-content>

Here is the link to documentation: https://material.angularjs.org/#/layout/grid

The issue that the flex property of the input (text) and input (button) are not obeying the flex attribute.

What I am trying to achieve is something like that: enter image description here

like image 610
vlio20 Avatar asked Feb 10 '15 21:02

vlio20


People also ask

What is the difference between AngularJS material layout and angular flex layout?

When compare to AngularJS Material layout, angular flex layout has several advantages. The Angular flex layout code is easier to maintain and debug. Angular flex layout does not depend upon Angular Material. There is no external CSS requirements. Angular flex layout Supports different kinds of Handset/Tablet and Orientation breakpoints.

How to use CSS flex-box features in angular?

Flex-layout is a package made for Angular to use CSS flex-box features, you just add directives in html tags to render it flexible and responsive. Let’s see how beginning with all this! Check out our Angular In-House trainings or a public Angular course s. Try out fossilo.com our angular project to archive complete websites.

What is the difference between mat elements and flex-layout?

With mat elements, you can make a nice interface in a very short amount of time. Flex-layout is a package made for Angular to use CSS flex-box features, you just add directives in html tags to render it flexible and responsive. Let’s see how beginning with all this! Check out our Angular In-House trainings or a public Angular course s.

What are the limitations of a CSS based Flexbox layout?

AngularJS Material clearly explained the limitations of a CSS based FlexBox layout like limitations with using parameterized values. Even for limited set of allowed value variations we need to write so many required CSS classes which increses the complexity of the code.


1 Answers

here is the result after I tried it,

hopefully it helps:

<md-content layout="row" layout-align="center">
  <div layout="column">
    <div flex layout="column" layout-fill> <!-- this is what I change -->
      <div flex="33">
        <md-input-container>
          <label>Enter Room's Name</label>
          <input ng-model="test" placeholder="Enter Room's Name">
        </md-input-container>
      </div>
      <div flex="66">
        <md-button class="md-raised md-accent">
          Create Chat Room
        </md-button>
      </div>
    </div>
  </div>

</md-content>
like image 194
dsteve Avatar answered Sep 28 '22 06:09

dsteve