错误:[$ compile:ctreq]无法找到指令' mdOption'所需的控制器&mdSelectMenu'!
答案 0 :(得分:0)
使用 <md-select>
代替 md-selectmenu
。
<强>样本强>
angular.module('materialApp', ['ngMaterial', 'ngAnimate'])
&#13;
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.4/angular-material.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.4/angular-material.min.js"></script>
<body ng-app="materialApp">
<md-select class="width-100" placeholder="Quantity" data-ng-model="task.qty">
<md-option value="one">One</md-option>
<md-option value="two">Two</md-option>
<md-option value="three">Three</md-option>
<md-option value="four">Four</md-option>
<md-option value="five">Five</md-option>
</md-select>
</body>
&#13;
答案 1 :(得分:0)
<md-option>
元素仅允许用作<md-select>
元素的子元素:
<md-input-container>
<md-select ng-model="someModel" placeholder="Select a state">
<md-option ng-value="opt" ng-repeat="opt in neighborhoods2">{{ opt }}</md-option>
</md-select>
</md-input-container>
<md-select>
元素是必需的。