在ng-include的外部页面上使用ng-model

返回
Author Avatar
钢翼
2017-06-23
编程
149

当我们需要在ng-include的外部页面上使用ng-model时,如果我们直接用$scope的变量,则会出现双向绑定失败。

正确的做法如下:

On the controller:

$scope.selection = {}

On the HTML:

ng-model="selection.numLines"