Issue
I'm having some trouble trying to include an input-group and a couple of buttons on the same line using angular-material.
The following HTML structure produces the result you can see on the image below it, which is not what I want:
<section layout-align="end center" layout-padding flex>
<div layout="row" layout-align="start center" flex>
<div class="input-group">
<input type="text" class="form-control" ng-model="monitor.query" placeholder="Search reports" aria-describedby="addon">
<span class="input-group-addon" id="addon"><i class="fa fa-search"></i></span>
</div>
</div>
<section layout-padding>
<md-button class="md-primary" data-dismiss="modal" type="submit" id="submit" value="Submit" ng-click="monitor.newReport();">New Report</md-button>
<md-button class="md-hollow disabled" data-dismiss="modal" type="button">Export</md-button>
</section>
</section>
However, if I try to include all elements within the same layout="row", the input-group ends up taking all the space and pushing the buttons out of the parent div:
<section class="no-print" layout-align="end center" layout-padding flex>
<div layout="row" layout-align="start center" flex>
<div class="input-group">
<input type="text" class="form-control" ng-model="monitor.query" placeholder="Search reports" aria-describedby="addon">
<span class="input-group-addon" id="addon"><i class="fa fa-search"></i></span>
</div>
<md-button class="md-primary" data-dismiss="modal" type="submit" id="submit" value="Submit" ng-click="monitor.newReport();">New Report</md-button>
<md-button class="md-hollow disabled" data-dismiss="modal" type="button">Export</md-button>
</div>
</section>
Is there a right way of having an input group and a couple of buttons all on the same line using angular-material or do I have to create my own styles?
Solution
Try the following code:
<form layout layout-align="center" layout-padding>
<div layout="row" flex>
<md-input-container flex class="md-icon-float md-block md-title">
<label>Your font number</label>
<!-- below is the material icons -->
<md-icon class="material-icons">phone</md-icon>
<input type="text">
</md-input-container>
<div>
<md-button class="md-raised">
<!-- below is the material icons -->
<md-icon class="material-icons">search</md-icon>
</md-button>
</div>
</div>
</form>
see a sample in the following link http://codepen.io/cmwang-cottageclothing/pen/BjpdVQ?editors=1000
Answered By - 基米王


0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.