仍然努力学习角角,指令隔离范围
我这里有一个plunker https://plnkr.co/edit/3FLmBtHP5TuOwWZHBMLK?p=preview
我只是想创建隔离范围指令的例子。
我使用$ http和承诺获得一些虚拟JSON与汽车的细节。
我试图在指令中显示汽车的详细信息。
该指令有一个隔离范围,我试图通过'汽车'。
我正在使用ng-repeat遍历json,但它只是重复一次指令。
我收到一个控制台错误,说'汽车'没有定义。
(function() {
angular
.module('cxoJsApp')
.directive('simple', function() {
return {
restrict: 'E',
controller: 'simpleController',
controllerAs: 'simpleCtrl',
scope: {
car: '='
},
bindtoController: true,
templateUrl: 'simple.html'
};
});
})();