看最后的ngnice上面的injector的示例的问题
jquery 和angularjs 不再引用。
<body ng-app="string">
<div ng-controller="ctrl1">
{{gameName}}
</div>
</body>
var a = angular.module('string', []);
var _div = $("<div class='' ng-controller='t1'>{{label}}</div>");
$(document.body).append(_div);
a.controller('ctrl1', ['$scope', function(c){
c.gameName='controller';
}]);
angular.element(document).injector().invoke(function($compile){
var scope = angular.element(_div).scope();
$compile(_div)(scope);
});
function t1($scope){
$scope.label = 'injector';
}运行后的代码错误点为 invoke ,Uncaught TypeError: Cannot read property 'invoke' of undefined