我有一组选项卡:
<tabset class="tab-container">
<tab id = "tabContent" ng-repeat="tab in tabs" active="tab.active" ng-model = "cmModel"> <!-- the tab highlight directive -->
<tab-heading>
<span>{{tab.title}}</span>
<i class="glyphicon glyphicon-remove" ng-click="removeTab($event, $index)"></i> <!-- the tab close button -->
</tab-heading>
<textarea ui-codemirror='cmOption' id="{{ 'Tab ' + ($index+1) }}" ng-model = "Text"> + "awefwef" + </textarea>
</tab>
<button class="btn btn-default" ng-click="addTab()"></button>
</tabset>
我正在尝试使用 ng-model = "Text"设置动态 ng-model。
首先,我知道如果我真的想添加动态 ng-models,我不能让它们全部相同(需要以某种方式将 $index 添加到 Text)。然而,最紧迫的问题是 $scope.Text 未定义,即使我明确添加了带有 ng-model Text 的文本区域。
我做错了什么?
谢谢。
最佳答案
我认为如果在选项卡中找不到您的 ng-model 的值,它将得到一个未定义的值。
关于javascript - 具有 Ng-Repeat 的动态 Ng 模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31441260/