angularjs – 无法找到指令’ngMessage’所需的控制器’ngMessages’

前端之家收集整理的这篇文章主要介绍了angularjs – 无法找到指令’ngMessage’所需的控制器’ngMessages’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
嗨我按照jonhpapa规则使用 angularjs(1.5.0)开发应用程序.
我也使用角度材料1.0.6.

添加模块’ngMessages’时遇到问题.

我安装了lib angular-messages 1.5.1.

当我添加要使用的模块时,我在控制台上有以下错误.

Error: [$compile:ctreq] Controller 'ngMessages',required by directive 'ngMessage',can't be found!
http://errors.angularjs.org/1.5.0/$compile/ctreq?p0=ngMessages&p1=ngMessage
    at http://localhost:3000/bower_components/angular/angular.js:68:12
    at getControllers (http://localhost:3000/bower_components/angular/angular.js:8817:19)
    at nodeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8982:33)
    at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8226:13)
    at nodeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8973:24)
    at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8226:13)
    at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8229:13)
    at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8229:13)
    at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8229:13)
    at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8229:13) <div data-ui-view="" class="ng-scope">

此时此视图没有控制器.该视图包含:

<md-input-container>
            <label>First name</label>
            <input name="firstName" 
              ng-model="vm.user.firstName"
              md-maxlength="30" 
              required>
              <div ng-messages="vm.user.firstName.$error">
                <div ng-message="md-maxlength">Field has to be less than 30 characters long.</div>
                <div ng-message="required">Field required</div>
              </div>
          </md-input-container>

在此先感谢,问候.

解决此问题,请替换以下内容

ng-message的ng-message

这是打字错误.

猜你在找的Angularjs相关文章