Error with ng-messages-include within <ion-view>


#1

can any1 help me?
I include ng-messages in my ion-view

example.

<div class="form-errors" ng-messages="frm1.username.$error" ng-messages-include="templates/form-errors.html">

but I get this error,

Error: [$compile:ctreq] Controller ‘ngMessages’, required by directive ‘ngMessagesInclude’, can’t be found!
http://errors.angularjs.org/1.4.3/$compile/ctreq?p0=ngMessages&p1=ngMessagesInclude
at http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:8895:12
at getControllers (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16834:19)
at nodeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16981:33)
at compositeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16368:13)
at compositeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16372:13)
at nodeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16972:24)
at compositeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16368:13)
at compositeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16372:13)
at nodeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16972:24)
at compositeLinkFn (http://localhost:4400/js/ionic/1.1.0/ionic.bundle.js:16368:13)
ionic.bundle.js (21157,24)

please help me.

thanks


#2

Hello,

Use the ng-messages-include tag instead of attribute.
Example:
<ng-messages-include src="templates/form-errors.html"></ng-messages-include>


#3

Starting Angular 1.4.0 there are breaking changes that require you to use ngMessagesInclude in its own element.

Either as shown by Xrah in an example

OR as shown below



The inlining of ng-messages-include is no longer valid: https://github.com/angular/angular.js/issues/11404