0
我正在使用Angular-app作爲我的項目的種子應用程序。我寫了不少頁面,一切看起來都很好。控制器中未定義的作用域變量
但是在這裏我的模板看起來像這樣的情況之一:
<div ng-switch on="result">
<div ng-switch="error">Something went wrong!, try later</div>
<div ng-switch-default>
Wait loading information!!!!
</div>
<div ng-switch-when="ok">
<form ng-submit="sendData()">
<input type="text" ng-model="myName"/ >
<button type="submit" >Create entry</button>
</form>
</div>
</div>
即使我鍵入myName
我得到一個未定義的任何有價值的東西,當我提交表單?
爲什麼範圍迷路了?
是因爲ng-switch
?我試着把ng-controller="MyController"
放在
<div ng-switch-when="ok" ng-controller="MyController">....</div>
它工作得很好!
雖然如果我嘗試使用更大的div
一切之上,範圍再次
由於一噸。這工作完美 –