user3024814 user3024814 - 5 months ago 66
AngularJS Question

Conditional flex in Angular material

Given the bootstrap layout definition

ng-class="{'col-sm-6':vm.data.mode === 'ADD', 'col-sm-3': vm.data.mode === 'EDIT'}"


What's the angular material equivalent? (To set flex="50" if vm.data.mode === 'ADD' and set flex="25" if vm.data.mode === 'EDIT')

Answer

You can try below.

<div layout="row" layout-wrap>
  <div flex-gt-sm="{{vm.data.mode === 'ADD' ? 50: 25}}"></div>
  <div flex-gt-sm="{{vm.data.mode === 'ADD' ? 50: 25}}"></div>
  <div flex-gt-sm="{{vm.data.mode === 'ADD' ? 50: 25}}"></div>
</div>
Comments