控制器和指令请求同一元素上的隔离范围

Controller and Directive requesting isolated scope on the same element

本文关键字:隔离 范围 元素 指令 请求 控制器      更新时间:2023-09-26

尝试在元素上添加 ng-intro-options 属性时出现问题

《守则》

var App = angular.module('MyApp', ['infinite-scroll', 'angular-intro']);
App.controller('MyController', ['$scope', function($scope){
    $scope.IntroOptions = {}
}]);

和 HTML

<body ng-controller="MyController" ng-intro-options="IntroOptions">

但是AngularJS在提到URL时抛出错误:

http://docs.angularjs.org/error/$compile/multidir

一旦我在正文标签上添加角度介绍的 attr,就会抛出错误。我正在使用角度 1.3.5

最新版本的 angular 存在问题,这不是稳定版本。

这个问题甚至可以在角度 1.3.0 中重现

它按预期工作,https://code.angularjs.org/1.2.27/angular.js稳定版本。

角度 1.2.27 Fidlle 按预期工作。

角度 1.3.0 及更高版本 Fidlle 给出一些错误,就像你得到的那样。检查控制台

切换回稳定版本将解决您的问题。

希望对您有所帮助。