我尝试在我的应用中运行这个简单的演示:
http://codepen.io/camden-kid/pen/Kgdvgd?editors=1010#0
在View1.js
中执行:
'use strict';
angular.module('rfApp.view1', ['ngRoute', 'ngMaterial', 'ngMessages'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'view1/view1.html',
controller: 'View1Ctrl'
});
}])
.controller('View1Ctrl', function($scope) {
$scope.currentNavItem = 'page1';
});
View1.html
<md-content class="md-padding">
<md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="navigation links">
<md-nav-item md-nav-click="goto('page1')" name="page1">Page One</md-nav-item>
<md-nav-item md-nav-click="goto('page2')" name="page2">Page Two</md-nav-item>
<md-nav-item md-nav-click="goto('page3')" name="page3">Page Three</md-nav-item>
<!-- these require actual routing with ui-router or ng-route, so they won't work in the demo
<md-nav-item md-nav-sref="app.page4" name="page4">Page Four</md-nav-item>
<md-nav-item md-nav-href="#page5" name="page5">Page Five</md-nav-item>
-->
</md-nav-bar>
<div class="ext-content">
External content for `<span>{{currentNavItem}}</span>`
</div>
</md-content>
得到:
答案 0 :(得分:0)
问题出在我的角度和角度材料版本中。当我将角度更改为1.5.9
并将角度材质更改为1.0.0
时,它开始工作