'ng消息'没有在angular js中实例化
'ngMessages' not instantiated in angular js
下面是我的代码
// LoginCtrl.js
angular.module('homeon', [ 'ngMessages' ]).controller('loginCtrl',
function($rootScope, $scope, $state, $ionicLoading, dbservices, server) {
//--------------------------------- my code-------------
})
<!-- login.html-->
<link href="css/login.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.4/cerulean/bootstrap.min.css">
<!-- load angular -->
<script src="http://code.angularjs.org/1.4.3/angular.js"></script>
<!-- load ngmessages -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-messages.js"></script>
<!-- load our custom app -->
<script src="js/loginCtrl.js"></script>
<body ng-app="homeon">
<ion-view view-title="Login">
<ion-content>
<form name="loginForm" ng-submit="doLogin(loginForm)" novalidate="">
<div class="list list-inset">
<label class="item item-input itemLabel">
<input type="email" name="username" placeholder="Email" ng-model="username" required="required" ng-minlength="5" >
</label>
<label class="item item-input itemLabel">
<input type="password" name="password" placeholder="Password" ng-model="password" required="required" pattern="(?=.*'d)(?=.*[a-z])(?=.*[A-Z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{8,}" autocapitalize="off" autocomplete="off" autocorrect="off">
</label>
<div ng-messages="loginForm.username.$error" style="color:red; align:center">
<span ng-message="required">Please enter user name</span>
<span ng-message="minlength">Length of email must be minimum 5 characters</span>
<span ng-message="email">Please enter valid email</span>
<div>
</div ng-messages="loginForm.password.$error" style="color:red; align:center">
<span ng-message="required">Please enter password</span>
<span ng-message="pattern">The passwords must be at least 8 characters and include an
uppercase, lowercase, number, and special character</span>
</div>
<button type="submit" class="button button-block" ng-click="" >Login</button>
</div>
</form>
</ion-content>
</ion-view>
</body>
我在浏览器中收到"ngMessages"未实例化错误。你能告诉我我哪里做错了吗?或者为什么会出现这个错误?
提前谢谢。
在index.html页面中包含<script src="js/angular-messages.js"></script>
相关文章:
- 角度 JS 控制器未实例化
- 挖空.js:等待视图模型实例化完成
- 为什么我在尝试实例化一个空的backbone.js视图时出现类型错误
- 无法实例化Angular js中的模块错误
- backbone.js未捕获类型parentView尝试实例化子视图时出错
- 在实例化时检查视频.js对象的更好方法
- 使用下划线 js map 函数时,Mongo 引用字段未实例化
- 我如何实例化不同页面上的 require.js 模块,带有代码点火器的部分
- Backbone.js集合在实例化时将自身的副本添加到集合中
- 主干.js:如何在集合/其他模型中实例化模型
- 是否可以在 Node.js 中侦听对象实例化
- 'ng消息'没有在angular js中实例化
- 在Backbone,js中实例化对象与函数
- 如何在创建特定类的所有元素时实例化JS小部件
- 我如何在JS中动态地要求模块、实例化对象和调用函数
- 不能在javascript (node.js)中实例化对象
- Angular js错误:[$injector:modulerr]实例化ngroute模块失败,原因是:
- js蒸汽交易机器人,找到实例化的项目
- 是否有可能在html文档中的新标签中实例化html/js模板?
- JS:在对象实例化之前替换函数定义