How can make the md-tabs length take all parent length - angularjs

I have the following tabs inside my project but my problem that the tabs is not cover all the space
<fieldset class="form-group userEditGrid" ng-if="proj.checkEditProjectPanelCriteria(proj.selectionRow)" style="top:42%; height: 55%; !important">
<legend style="color:#d77509;font-weight:bold; border:0px; width:10%;" > {{proj.getMode()}}</legend>
<div ng-cloak="" class="tabsdemoDynamicHeight">
<md-content>
<md-tabs md-dynamic-height="" md-border-bottom="" md-selected="proj.selectedLevelTabs" >
<md-tab label="General Information" ng-disabled = "proj.isFireProtectionPanelOpen() || proj.isAddDocumentPanelOpen()">
<form name="editForm">
<md-content class="md-padding">
<div class="row" disable-all = "proj.ViewMode == 1">
<div class="row">
<div class="col-sm-2" ng-class="{ 'has-error': editForm.projanyname.$dirty && editForm.projectname.$error.required }">
<md-input-container class="md-block" >
<label for="projectname">Project Name *</label>
<input type="text" name="projectname" id="projectname" class="form-control" ng-model="proj.copyProjectRow.projectName" required="">
<span ng-show="editForm.projectname.$dirty && editForm.projectname.$error.required" class="help-block">project name is required</span>
</md-input-container>
</div>
</div>
</div>
</md-content>
</form>
</md-tab>
<md-tab>
<md-content class="md-padding">
<div class="row">
<jsp:include page="levels/level1.jsp" />
</div>
</md-content>
</md-tab>
</md-tabs>
</md-content>
</div>
</fieldset>
How can I make the length of the tabs take up all the space?
NOTE: I call this file form other jsp file
<div>
<jsp:include page="editProject.jsp" />
</div>

This is how I do to fill 100% height of the md-tab body:
First of all we need to create a CSS class to make first child of md-tab-content 100% height:
md-tab-content > div {
height: 100%;
}
Then the structure of a tab must be like this:
<md-tab>
<md-tab-label>Tab title label</md-tab-label>
<md-tab-body>
<div layout-fill layout="column">
<p>This will be full height</p>
</div>
</md-tab-body>
</md-tab>
Note that we must use layout-fill on the container inside <md-tab-body> to make it grow with 100% height. If we need to have more children layouts inside our container we must use layout="column"to make them grow vertically and use flexattributes as we need our layout structure.
I hope this solve your problem! It's probably impossible to make md-tab-bodycontent grow only using flex and not using CSS classes.

Related

Is it possible to link md-autocomplete to a form input box

I am completely new to angular JS. I have a form with a keyword input box. I need to add auto-complete feature to this input box using angularJS md-autocomplete. My existing html code is as shown below:
Output with input tag
<div class="container formHolder" ng-controller="AppController as ctrl">
<form class="form-horizontal" name="myForm" novalidate>
<h4 class="page-header" style="text-align: center;"><b>Keyword Search</b></h4>
<div class="form-group row" style="padding-left: 2%;padding-right:2%; padding-top: 3%;">
<label for="keyword" class="control-label col-sm-3 labels">Keyword <sup style="color: red">*</sup></label>
<div class="col-sm-9">
<input type="text" ng-class="{errorBorder: myForm.keyword_name.$touched && myForm.keyword_name.$invalid}" class="form-control" ng-model="keyword_name" ng-keyup="total(keyword_name)" name="keyword_name" id="keyword" placeholder="Enter Keyword" required>
<!-- Md auto complete to be attached to this input here -->
</div>
</div>
<div class="form-group row" style="padding-left: 2%;padding-right:2%; padding-bottom: 3%">
<div class="col-sm-9">
<button type="submit" ng-disabled="myForm.$invalid" class="btn btn-primary justify-content-center align-content-between" style="margin-right: 10px"><i class="material-icons" style="vertical-align:middle;">search</i>Search</button>
</div>
</div>
</form>
</div>
I want to add auto-complete using AngularJS, so I used md-autocomplete as shown in the code snippet below.
Output with md-autocomplete tag
<div class="container formHolder" ng-controller="AppController as ctrl">
<form class="form-horizontal" name="myForm">
<h4 class="page-header" style="text-align: center;"><b>Keyword Search</b></h4>
<div class="form-group row" style="padding-left: 2%;padding-right:2%; padding-top: 3%;">
<label for="keyword" class="control-label col-sm-3 labels">Keyword <sup style="color: red">*</sup></label>
<div class="col-sm-9">
<!-- Md auto complete to be attached to this input here -->
<md-autocomplete
md-input-name="keyword"
md-selected-item="ctrl.selectedItem"
md-search-text-change="ctrl.searchTextChange(ctrl.searchText)"
md-search-text="ctrl.searchText"
md-selected-item-change="ctrl.selectedItemChange(item)"
md-items="item in ctrl.querySearch(ctrl.searchText)"
md-item-text="item.display"
md-min-length="1"
placeholder="Keyword Search">
<md-item-template>
<span md-highlight-text="ctrl.searchText" md-highlight-flags="^i">{{item}}</span>
</md-item-template>
</md-autocomplete>
</div>
</div>
<div class="form-group row" style="padding-left: 2%;padding-right:2%; padding-bottom: 3%">
<div class="col-sm-9">
<button type="submit" ng-disabled="myForm.$invalid" class="btn btn-primary justify-content-center align-content-between" style="margin-right: 10px"><i class="material-icons" style="vertical-align:middle;">search</i>Search</button>
</div>
</div>
</form>
</div>
But this replacement changes the style of my input box. I want my input box to be like the one shown in the first image. So is there a way to retain my input box and add autocomplete to it, so that the style remains unchanged. Or is there a way by which I can style my md-autocomplete element to look as in the first image?
Please help me on this.

How to align the angular sidenav in md-toolbar? And the content below it

Here is a codepen link
I'm trying to make an Angular sidenav, that must be aligned in a row with some form (which contains search box) which are in a md-toolbar and below of toolbar.
I am having someother stuff, like in the link above, the p tag text should be immediately after the md-toolbar but my sidenav is occupying much space below and I am not able to adjust the layout.
Can anyone help me fixing this out?
Got it fixed. Actually i was trying to keep the sidenav content in the md-toolbar itself ,but when i separated it the issue fixed. here's the code
header.html file
<md-toolbar ng-controller="toolBarController">
<div class="md-toolbar-tools">
<img src="img/logo/oxkey.png">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div id="right">
<form class="navbar-form" role="search">
<div class="input-group">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
<input type="text" class="form-control" placeholder="Search Properties" name="q">
</div>
</form>
</div>
</div>
<button type="button" class="btn btn-info">For Landlords</button>
<md-button class="md-icon-button" ng-click="toggleRight()" ng-hide="isOpenRight()" class="md-primary">
Menu
</md-button>
</md-toolbar>
sidenav.html
<md-toolbar class="md-theme-light">
<h1 class="md-toolbar-tools">Menu</h1>
</md-toolbar>
<md-content ng-controller="RightCtrl" layout-padding="">
<form>
<md-input-container>
<label for="testInput">Test input</label>
<input type="text" id="testInput" ng-model="data" md-autofocus="">
</md-input-container>
</form>
<md-button ng-click="close()" class="md-primary">
Close
</md-button>
</md-content>
</md-sidenav>

How to add plus minus symbol to a bootstrap accordion along with angularjs

I am using bootstrap accordion in angular js. The panels are opening If I click on the heading directly but I need to add plus/minus symbols for each heading. Please help me out in achieving the functionality like If I click plus icon, panel should be open and If I click on minus symbol, the panel should be closed. Thanks in advance.
Sorry, I Cannot able to add fiddle or plunker as the data is coming from my local database.
<uib-accordion close-others="oneAtATime" class="accordion-data">
<uib-accordion-group heading="title from database" ng-repeat="values are coming from database">
<div class="row">
<div class="col-md-12">
<div class="row row-head">
<div class="col-md-6 col-xs-6">
</div>
</div>
<div class="row item-head accordion-content" ng-repeat="values are coming from database">
<div class="col-md-4 col-xs-4"><input type="checkbox" ng-model="check" >data from database
</div>
<div class="col-md-8 col-xs-8 service-data">
<div class="row">
<div class="col-md-2 col-xs-2"></div>
<div class="col-md-2 col-xs-2">
<input type="number" class="form-data" ng-disabled="!check">
</div>
<div class="col-md-2 col-xs-2">
<input type="number" name="times" class="form-data" ng-disabled="!check">
</div>
<div class="col-md-2 col-xs-2">
<input type="text" class="form-data" ng-disabled="!check" ng-readonly="true" >
</div>
<div class="col-md-2 col-xs-2">
<input type="text" class="form-data" ng-disabled="!check" ng-readonly="true" >
</div>
<div class="col-md-2 col-xs-2">
<input type="text" class="form-data" ng-disabled="!check" ng-readonly="true" >
</div>
</div>
</div>
</div>
</div>
</div>
</uib-accordion-group>
</uib-accordion>
I don't know the specifics about your implementation, but you could make use of the CSS :before pseudo-element like I have done in this simple fiddle.
If you have a way of selecting the accordion header by the open/closed state, then you can do something similar to this:
.accordion li.open:before {
content: '- ';
}
.accordion li.closed:before {
content: '+ ';
}
glyphicon glyphicon-plusIf you want to handle this in javascript, you could use the collapse event described here.
shown.bs.collapse will fire when a collapse element has been made visible to the user (will wait for CSS transitions to complete).
hidden.bs.collapse will fire when a collapse element has been hidden from the user (will wait for CSS transitions to complete).
$('#yourCollapseDiv').on('shown.bs.collapse', function () {
$(".glyphicon").removeClass("glyphicon glyphicon-minus").addClass("glyphicon glyphicon-plus");
});
$('#yourCollapseDiv').on('hidden.bs.collapse', function () {
$(".glyphicon").removeClass("glyphicon glyphicon-plus").addClass("glyphicon glyphicon-minus");
});
It uses glyphicons to display the + and -

Div not width adapt to parent Angular Material

My form with #formLogin ID not adapt to width parent. It's small, it's weird.
Help me please.
I want to adapt the form to parent.
I see it very small.
<body layout="row">
<div flex>
</div>
<div id="formLogin" layout="column" layout-align="center center" flex="40" flex-sm="90" flex-md="70">
<div>
<md-toolbar class="md-primary">
<div class="md-toolbar-tools">
<h2 class="md-flex">Acceso a la Intranet</h2>
</div>
</md-toolbar>
<md-content flex="auto" layout-padding>
<md-input-container>
<label>RUT</label>
<input ng-model="login.rut" type="text">
</md-input-container>
<md-input-container>
<label>ContraseƱa</label>
<input ng-model="login.contrasena" type="password">
</md-input-container>
<md-button class="md-raised" style="width:90%;">Ingresar</md-button>
</md-content>
</div>
</div>
<div flex>
</div>
</body>
By setting the attribute flex="grow" the element will fit its parent width and shrink automatically. Though you are also using layout-align="center center" which literally places the div vertically and horizontally in the center. I believe that's not exactly what you want, but if you read the documentation you'll get all your answers.

Angular Materials flex box model not apply correctly

I am working with angualar and angular material and I am trying to create something linke this -> http://gyazo.com/51b99edb716687f6096e4cff7d009e8d
but for some reason my image (logo) stretches over de width, this is what I have now -> http://gyazo.com/277f2bcf6b47861412d8e5df949d8313
I can't even seem to get it in the middle of the screen
If any one can help me out and get me going with this flex box model I would appreciate it
this is my code:
<div layout="row" flex layout-padding layout-fill layout-align="center center">
<div flex="40" flex-lg="50" flex-md="70" flex-sm="100">
<md-card>
<md-toolbar>
<div>
<div><img src="../images/logo.png" alt="Zazzle logo"></div>
<h1 class="md-headline">
Sign up
</h1>
</div>
</md-toolbar>
</md-card>
</div>
</div>
To center something add a div with layout="row" and within the div add a <span flex></span> before and after the div you are trying to center.
This is how I do it for my login page to center the input divs. I am still trying to learn myself, so I am not sure if it is the right way or not but you can surely try it:
<div layout="row">
<span flex></span>
<div class="well" flex='30'>
<form ng-submit="vm.login()" name="loginForm">
<md-input-container>
<label>Email</label>
<input type="text" ng-model="vm.email" required/>
<div ng-messages="loginForm.email.$error" ng-if='loginForm.email.$dirty'>
<div ng-message="required">This is required.</div>
</div>
</md-input-container>
<md-input-container>
<label>Password</label>
<input type="password" ng-model="vm.password"/>
</md-input-container>
<md-button type="submit" class="md-raised md-primary">Submit</md-button>
</form>
</div>
<span flex></span>
</div>
Hope this helps :)

Resources