0
我有一個帶有2個表單元素的html文件,其中包含兩個輸入元素。我將使用ng-if來選擇我需要的表單元素。輸入元素綁定到相同的模型。但我無法在表單範圍之外解決它。在表單之外解析ng-model
<form ng-if="some_name == '1'">
<input ng-model="model_name">
</form>
<form ng-if="some_name == '2'">
<input ng-model="model_name">
</form>
{{model_name}} //This is different from the value of either of the input elements
//it has the initial value which i would assign : $model_name = "xyz"; in my associated js file
可能你這個問題,增加更多的細節,因爲它是很難理解的實際問題。 –
請添加您的控制器邏輯。 – lin