我想使用 Angular Material 创建带有侧边菜单的应用程序。我得到错误:[$compile:multidir]
。
我做错了什么?
这是我的 index.html:
<!doctype html>
<html ng-app="myApp">
<head>
<meta charset="utf-8">
<link href="/css/angular-material.min.css" rel="stylesheet" />
</head>
<body>
<div class="container" layout="row" flex>
<md-sidenav ng-controller="leftMenuController" md-is-locked-open="true">Sidenav</md-sidenav>
<md-content flex id="content" flex><ng-view></ng-view></md-content>
</div>
<script src="/js/lib/angular.min.js" type="text/javascript"></script>
<script src="/js/lib/angular-animate.min.js" type="text/javascript"></script>
<script src="/js/lib/angular-aria.min.js" type="text/javascript"></script>
<script src="/js/lib/angular-sanitize.min.js" type="text/javascript"></script>
<script src="/js/lib/angular-route.min.js" type="text/javascript"></script>
<script src="/js/lib/angular-material.min.js" type="text/javascript"></script>
<script src="/js/engine.js" type="text/javascript"></script>
<script src="/js/controllers/leftMenuController.js"></script>
<script src="/js/controllers/authController.js"></script>
<script src="/js/controllers/clientsController.js"></script>
</body>
</html>
这是我的leftMenuController:
myApp.controller('leftMenuController',
function leftMenuController($scope, $location){
console.log("leftMenuController" + $location.url().toString());
}
);
这是我的 auth.html 和 authController.js:
<div ng-controller="authController">
<md-button class="md-raised" ng-click="login()">Button</md-button>
</div>
myApp.controller('authController',
function authController($scope, $location){
$scope.login = function () {
$location.path( "/clients" );
}
}
);
这是我的engine.js:
var myApp = angular.module('myApp', ["ngRoute", "ngMaterial"])
.config(function($routeProvider){
$routeProvider.when('/auth',
{
templateUrl:'/views/auth.html',
controller:'authController'
});
$routeProvider.when('/clients',
{
templateUrl:'/views/clients.html',
controller:'clientsController'
});
$routeProvider.otherwise({redirectTo: '/auth'});
});