我更新了AngularJs版本從1.3到1.4。 它會導致一個錯誤,更新的Angular版本導致ngMessages錯誤
Syntax Error: Token '{' invalid key at column 2 of the expression
[{{frmname}}.emailAddress.$error] starting at [{frmname}}.emailAddress.$error].
它完美地在角1.3
<form name="{{frmname}}">
<h1>My form name = {{frmname}}</h1>
<div class="field">
<label for="emailAddress">Enter your email address:</label>
<input type="email" name="emailAddress" ng-model="email" required />
<div ng-messages="{{frmname}}.emailAddress.$error">
<div ng-message="required">
You forgot to enter your email address...
</div>
<div ng-message="email">
You did not enter your email address correctly...
</div>
</div>
</div>
<input type="submit" />
</form>
什麼版本究竟是你之前使用,現在使用的是? – thepio
1.3.15到1.4.8 –
它在1.3.15中工作正常 https://plnkr.co/edit/6UqmxJ0c8RsGzYpK6k6Y?p=preview –