Angular md-select in md-dialog - angularjs

I am using a md-select in a md-dialog. The drop down content has a scroll bar but I need the window to scroll.
Here is my code:
Dialog (in script element):
<md-dialog aria-label="Mango (Fruit)">
<form ng-cloak>
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Click Select menu and then scroll the page</h2>
<span flex></span>
<md-button class="md-icon-button" ng-click="cancel()">
<md-icon md-svg-src="img/icons/ic_close_24px.svg" aria-label="Close dialog"></md-icon>
</md-button>
</div>
</md-toolbar>
<md-dialog-content>
<div class="md-dialog-content" layout="row" layout-align="center">
<md-input-container flex="80">
<label>Selcet your option</label>
<md-select ng-model="size">
<md-option value="option 1">option 1</md-option>
<md-option value="option 2">option 2</md-option>
<md-option value="option 3">option 3</md-option>
</md-select>
</md-input-container>
</div>
</md-dialog-content>
<md-dialog-actions layout="row">
<md-button href="http://en.wikipedia.org/wiki/Mango" target="_blank" md-autofocus>
More on Wikipedia
</md-button>
<span flex></span>
<md-button ng-click="answer('not useful')">
Not Useful
</md-button>
<md-button ng-click="answer('useful')">
Useful
</md-button>
</md-dialog-actions>
</form>
</md-dialog>
The issue is that the content of the md-select is moving along with the scrolling. Can anyone suggest me a fix for this issue? I need both the window and md-select content to scroll.Thanks in advance.
Codepen

Related

Horizontal navigation in sidenav Angular

Can you please tell me if it is possible to implement navigation as in the following example? Only with the Angular Material. Thank you.
http://plnkr.co/edit/Ksfo7fnSB0c4DH6egE3S?p=preview&preview
<body ng-controller="MainCtrl" layout="row">
<md-sidenav class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="true">
<md-toolbar class="md-theme-light">
<h1 class="md-toolbar-tools">Sidenav Right</h1>
</md-toolbar>
<md-content ng-controller="RightCtrl" class="main-ctr md-padding">
<div ng-show="mainMenu" class="mainmenu"> <md-list>
<md-list-item>
<md-icon aria-label="home" class="material-icons"
style="">home
</md-icon>
<p class="md-body-2 side-nav-item">Home</p>
</md-list-item>
<md-list-item ng-click="nav('back')">
<md-icon aria-label="settings" class="material-icons">settings
</md-icon>
<p class="md-body-2 side-nav-item">Settings</p>
<md-button class="md-secondary md-icon-button" ng-click="nav('back')">
<md-icon aria-label="chevron_right" class="material-icons">chevron_right</md-icon>
</md-button>
</md-list-item>
</md-list>
</div>
<div ng-show="submenu" ng-class="{donotshow:donotshow, submenu: true}" >
<md-list>
<md-list-item ng-click="nav('main')">
<md-icon aria-label="chevron_left" class="material-icons"
ng-click="nav('main')">chevron_left
</md-icon>
<p class="md-body-2 side-nav-item">Back</p>
</md-list-item>
<md-list-item>
<md-icon aria-label="people" class="material-icons"
style="">people
</md-icon>
<p class="md-body-2 side-nav-item">My Profile</p>
</md-list-item>
<md-list-item>
<md-icon aria-label="people" class="material-icons"
style="">people
</md-icon>
<p class="md-body-2 side-nav-item">account</p>
</md-list-item>
</md-list>
</div>
</md-content>
</md-sidenav>
</body>
</html>
Perhaps there is a decent solution out of the box.
It should be possible to implement it by using stepper API.
https://material.angular.io/components/stepper/overview

How to handle nested md-content/div in angular 1.4

I would like to show a hidden Inputs when user click show button in angular material 1.4. For example When collapsed it would
When user click on the show button it would look
Following is the code i am fiddling with.
I would like to bring the input Boxes below the Header. It seems with the nested Div Block it is not working as expected. Can anyone help?
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Schedules">
<md-content class="md-padding">
<md-content class="md-padding">
<md-list-item ng-repeat="schedule in schedules">
<div layout="row">
<md-button class="md-icon-button" aria-label="Messages" ng-click="expandSchedule($index)">
<md-icon md-svg-src="Client/app/resources/images/icons/svg/expand_more.svg" ng-show="!schedule.showSchedule"></md-icon>
<md-icon md-svg-src="Client/app/resources/images/icons/svg/expand_less.svg" ng-show="schedule.showSchedule"></md-icon>
</md-button>
<p>{{schedule.humanReadableFormat}}</p>
<md-button class="md-icon-button pull-right" aria-label="Messages" ng-click="delSchedule($index)">
<md-icon md-svg-src="Client/app/resources/images/icons/svg/close.svg"></md-icon>
</md-button>
</div>
<div layout="row" ng-show="schedule.showSchedule">
<md-input-container>
<label>Title</label>
<input ng-model="user.title">
</md-input-container>
<md-input-container>
<label>Email</label>
<input ng-model="user.email" type="email">
</md-input-container>
</div>
<md-divider></md-divider>
</md-list-item>
</md-content>
<div class="md-padding">
<section layout="row" layout-align="center center" layout-wrap>
<md-button class="md-raised md-warn" aria-label="Add Schedule" ng-click="clickAddSchedule()">Add New Schedule</md-button>
</section>
</div>
</md-content>
</md-tab>
</md-tabs>
You didn't write exactly why it doesn't work as expected. But I guess you have a problem with using row twice:
<div layout="row">
...
<div layout="row">
Maybe try this:
<div layout="row">
<div flex>LEFT</div>
<div flex ng-class="{hide: !schedule.showSchedule}">RIGHT</div>
</div>

Angular Material: Each md-list-item takes full page width and Sidenav have long scrollbar

I'm trying to create angular material sidenav with list of menu items. When Im running the code on local machine, Each md-list-items takes fullpage width and sidenav have long scroll bar.
But When I run the same code on codepen.io, It displayed correctly.
<section layout="row" ng-controller="AppCtrl">
<md-sidenav class="md-sidenav-left md-whiteframe-z2" md-component-id="left" >
<md-toolbar ng-controller="LeftCtrl">
<div class="md-toolbar-tools">
<h1>Sidenav Right</h1>
<span flex></span>
<md-button class="md-icon-bitton" aria-label="Close Menu" ng-click="close()">
<md-tooltip md-direction="right">Close this menu</md-tooltip>
<md-icon md-font-icon="material-icons">close</md-icon>
</md-button>
</div>
</md-toolbar>
<md-content flex role="navigation">
<md-list>
<md-list-item>
<md-button>First Option</md-button>
</md-list-item>
<md-list-item>
<md-button>First Option</md-button>
</md-list-item>
<md-list-item>
<md-button>First Option</md-button>
</md-list-item>
</md-list>
</md-content>
</md-sidenav>
<md-content flex>
<md-toolbar>
<div class="md-toolbar-tools">
<md-button class="md-icon-button" aria-label="Settings" ng-click="toggleLeft()" ng-hide="isOpenLeft()">
<md-icon md-font-icon="material-icons">menu</md-icon>
</md-button>
<h2>
<span>Application Title</span>
</h2>
</div>
</md-toolbar>
</md-content>
</section>
Here is the codepen:http://codepen.io/nhere/pen/yOwJxE
Try to use the following structure
<md-list>
<md-item>
<md-item-content>
[Content Here]
</md-item-content>
</md-item>
</md-list>

md-menu inside md-list-item as a second action button

I have got the code below in my project and I have got this problem. When I will add the md-menu component into my dynamically generated (ng-repeat) md-list component, it will show this error in JS console:
Error: Invalid HTML for md-menu: Expected two children elements.
My HTML code:
<md-card>
<md-card-content>
<h2>Menu</h2>
<md-subheader class="md-no-sticky">List</md-subheader>
<md-list-item ng-repeat="playlist in playlists" ng-click="someAction()">
<p>{{playlist[1]}}</p>
<md-menu>
<md-icon aria-label="Action" ng-click="$mdOpenMenu($event)" class="md-secondary md-hue-3 material-icons">create</md-icon>
<md-menu-content>
<md-menu-item><md-button ng-click="">Edit</md-button></md-menu-item>
<md-menu-item><md-button ng-click="">Remove</md-button></md-menu-item>
</md-menu-content>
</md-menu>
</md-list-item>
</md-card-content>
</md-card>
Can you help me to solve this issue please?
I think, that the problem is when the code is builded, it looks different and then md-menu component has got 2 child inside (2 button), but I don't know, how to resolve this.
Here is the builded code:
<md-list-item class="md-with-secondary ng-scope md-clickable" tabindex="-1" role="listitem" ng-repeat="playlist in playlists">
<button tabindex="0" ng-click="someAction()" class="md-no-style md-button md-ink-ripple" ng-transclude="">
<div class="md-list-item-inner ng-scope">
<p class="ng-binding">test</p>
<md-menu class="md-menu ng-scope">
<md-menu-content>
<md-menu-item role="menuitem">
<button tabindex="0" type="button" ng-click="" class="md-button md-ink-ripple" ng-transclude="">
<span class="ng-scope">Edit</span>
</button>
</md-menu-item>
<md-menu-item role="menuitem">
<button tabindex="0" ng-click="" class="md-button md-ink-ripple" ng-transclude="">
<span class="ng-scope">Remove</span>
</button>
</md-menu-item>
</md-menu-content>
</md-menu>
</div>
<div style="" class="md-ripple-container"></div>
<div style="" class="md-ripple-container"></div>
</button>
<button tabindex="0" ng-click="$mdOpenMenu($event)" class="md-secondary-container md-icon-button md-button md-ink-ripple" ng-transclude="">
<md-icon tabindex="-1" aria-label="Open Chat" class="md-hue-3 material-icons ng-scope ng-isolate-scope">create</md-icon>
</button>
</md-list-item>
I also couldn't use md-menu inside md-list-item as a second action button when I was using Angular Material 1.0.0 RC1 but when I upgraded both js and css of Angular Material to 1.1.0 RC4 it worked. The working code is something like this and please notice the "md-secondary" class needs to be assigned to "md-menu":
<md-list flex>
<md-subheader class="md-no-sticky">sub header</md-subheader>
<md-list-item ng-click="goToPerson(person.name, $event)" class="md-2-line" ng-repeat="user in userManagement.users">
<img alt="{{ 'person.name' }}" ng-src="https://pixabay.com/static/uploads/photo/2014/03/25/16/54/user-297566_960_720.png" class="md-avatar"/>
<div class="md-list-item-text">
<h3>{{ user.firstName }} {{ user.lastName }} </h3>
<p>{{ user.email }} </p>
</div>
<md-menu md-position-mode="target-right target" class="md-secondary">
<md-button aria-label="Open demo menu" class="md-icon-button" ng-click="$mdOpenMenu($event)">
<md-icon md-menu-origin>menu</md-icon>
</md-button>
<md-menu-content width="4">
<md-menu-item ng-repeat="item in [1, 2, 3]">
<md-button ng-click="ctrl.announceClick($index)">
<div layout="row" flex>
<p flex>Option {{item}}</p>
<md-icon md-menu-align-target md-svg-icon="call:portable-wifi-off" style="margin: auto 3px auto 0;"></md-icon>
</div>
</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</md-list-item>
</md-list>
Every md-menu must specify exactly two child elements. The first
element is what is left in the DOM and is used to open the menu. This
element is called the trigger element.
https://material.angularjs.org/latest/api/directive/mdMenu
I think your ng-click="$mdOpenMenu($event)" needs to be on a md-button element, not the md-icon
go to source code of angular-material.js and add/modify that part... I will generate menu as secondary-item outside the item.
// Check for a secondary item and move it outside
if ( secondaryItem && (
isMdMenu(secondaryItem) ||
secondaryItem.hasAttribute('ng-click') ||
( tAttrs.ngClick &&
isProxiedElement(secondaryItem) )
)) {
tEl.addClass('md-with-secondary');
tEl.append(secondaryItem);
}
function isMdMenu(el) {
var nodeName = el.nodeName.toUpperCase();
return nodeName == "MD-MENU";
}

FAB Speed Dial and Simple dropdown menu not working

I've followed the demo as given in the angular material site.
https://material.angularjs.org/latest/#/demo/material.components.menu
I'm facing a problem where the simple dropdown menus and speed dials are just static and not initalized.
Can't seem to figure out what I am missing.
<div layout="column">
<md-content class="md-padding" layout="column">
<div class="lock-size" layout="row" layout-align="center center">
<md-fab-speed-dial md-open="false" md-direction="up"
ng-class="md-fling">
<md-fab-trigger>
<md-button aria-label="menu" class="md-fab md-warn">
<i class="fa fa-car"></i>
</md-button>
</md-fab-trigger>
<md-fab-actions>
<md-button aria-label="twitter" class="md-fab md-raised md-mini">
<i class="fa fa-car"></i>
</md-button>
<md-button aria-label="facebook" class="md-fab md-raised md-mini">
<i class="fa fa-car"></i>
</md-button>
<md-button aria-label="Google hangout" class="md-fab md-raised md-mini">
<i class="fa fa-car"></i>
</md-button>
</md-fab-actions>
</md-fab-speed-dial>
</div>
</md-content>
</div>
I changed the ng-class attribute on the <md-fab-speed-dial> tag to simply class, and it works now. Have a look at this link from the Angular Material site.
In your case, you should have:
<md-fab-speed-dial md-open="false" md-direction="up" class="md-fling">

Resources