у меня есть проблемы с доступом директивы от другого и коды нижеКак получить доступ к директиве от других в angularjs?
app.module('myApp', [])
.directive('vikiQues', ['$http', '$compile', function($http, $compile){
return {
restrict : 'E',
scope : true,
controller : [
function(){
}
],
link : function(scope, iElement, iAttrs){
$http.get('getOutside/1')
.then(function(data){
iElement.html($compile($(data.data))(scope));
/*scope.addThere.find('div.please-wait').remove();
scope.questionList.push({
text : '',
options : []
});*/
});
}
};
}]).directive('vikiOption', ['$http', '$compile', function ($http, $compile) {
return {
restrict: 'E',
scope : true,
require : '^vikiQues',
link: function (scope, iElement, iAttrs, vikiQuesCtrl) {
$http.get('getInside/1')
.then(function(data){
var _ = $(data.data);
scope._opt = false;
iElement.html($compile(_)(scope));
if (scope.$parent.questionList[scope.$parent.totalQuestionCount-1].options.length > 2)
_opt = true;
scope.now = {
id : scope.$parent.questionList[scope.$parent.totalQuestionCount-1].options.length,
char : '',
text : '',
image : '',
removeable : scope._opt,
};
ques.now.options.push(scope.now);
});
}
};
}]);
я получил эту ошибку каждый раз: angular.min.js: 117 Ошибка: [$ компиляции: ctreq] http://errors.angularjs.org/1.5.7/ $ компилировать/ctreq p0 = vikiQues & p1 = vikiOption
, что случилось там?
HTML код:
0" >
viki-ques и viki-option - это шаблоны, которые исходят от php. if i remove iElement.html ($ compile ($ (data.data)) (scope)); код, я не могу получить ошибку. Я думаю, что у меня есть ошибка. Эта ошибка возникает при компиляции ithink $ или области.(Помощь)
Post вашего HTML. – dfsq
Недостаточно информации, чтобы помочь. Создайте демо с проблемой, тогда легко понять проблему. – dfsq