我正在关注一个角度教程,我自我介绍了复选框中的ngTrueValue / ngFalseValue角度指令。
当我编码时:
<body>
<p ng-app="app" >
<input type="checkbox" ng-model="vm.clarooscuro" ng-true-value="claro" ng-false-value="oscuro"/>
Este campo tiene el value modificado. Ahora vale {{ vm.clarooscuro }}
</p>
<script src="lib/angular.min.js"></script>
</body>
Angular说:
Error: [$injector:modulerr] http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=app&p1=%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.4.8%2F%24injector%2Fnomod%3Fp0%3Dapp%0AG%2F%3C%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A6%3A416%0Ade%2F%3C%2F%3C%2F%3C%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A24%3A186%0Ab%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A23%3A251%0Ade%2F%3C%2F%3C%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A23%3A1%0Ag%2F%3C%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A38%3A117%0An%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A7%3A331%0Ag%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A37%3A488%0Aeb%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A41%3A249%0Ayc%2Fc%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A19%3A463%0Ayc%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A20%3A274%0AZd%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A19%3A83%0A%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A294%3A192%0Ab%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A175%3A62%0AIf%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A35%3A365%0AHf%2Fd%40file%3A%2F%2F%2Fhome%2Fleandro%2FDevelopment%2Fangularjs%2FManualdeAngularJS-Manualcompleto%2Flib%2Fangular.min.js%3A35%3A314%0A
...f e?JSON.stringify(e):e;d+=c(e)}return Error(d)}}function za(a){if(null==a||Xa(a...
我如何知道Angular想要告诉我什么?在上面的角度错误消息上写入错误消息的位置是什么? 问题的工具包是上面的例子不起作用 此致
答案 0 :(得分:1)
我根据您的代码在jsfiddle中创建了一个代码。
我添加了ng-controller指令
指令ng-true-value =&#34;&#39; claro&#39;&#34;内在值应包含在&#39;&#39;
因为你正在使用angularjs的minify js(src =&#34; lib / angular.min.js&#34;) 你可以添加ng-strict-di指令,它会告诉你是否有 缺少依赖注入注释。
最后一件事是js代码
angular.module('app', [])
.controller('myCtrl', function() {
var vm = this;
vm.clarooscuro = "claro";
})
查看我添加的demo以查看所有代码。