Javascript 标题未显示在AngularJS上(指令中的指令)
我在另一个使用AngularJS的指令中有一个指令。名为({{questions.n3A.name}})的标题未显示 以下是我的js:Javascript 标题未显示在AngularJS上(指令中的指令),javascript,angularjs,Javascript,Angularjs,我在另一个使用AngularJS的指令中有一个指令。名为({{questions.n3A.name}})的标题未显示 以下是我的js: .directive('myRating', function() { return{ restrict: 'E', template: '<div><div class="row question">{{questions.n3A.name}}</div> \ <div c
.directive('myRating', function() {
return{
restrict: 'E',
template: '<div><div class="row question">{{questions.n3A.name}}</div> \
<div class="row rating" ng-controller="RatingDemoCtrl"> \
<rating value="rate" max="max" readonly="isReadonly" state-on="\'glyphicon-star rated\'" state-off="\'glyphicon-star\'"></rating> \
<div class="col-md-12"> \
<button class="btn btn-sm btn-danger form-control" ng-click="rate = 0" ng-disabled="isReadonly">Clear</button> \
</div> \
</div> \
</div>',
replace: true,
scope: {
text: '@'
}
};
});
$scope.questions = {
"n3A": {
"name": "How safe did you feel on your trip?",
"ID": "n3A"
},
"n3B": {
"name": "How did you get there?",
"ID": "n3B"
},
指令('myRating',函数(){
返回{
限制:'E',
模板:“{questions.n3A.name}”\
\
\
\
清楚的\
\
\
',
替换:正确,
范围:{
正文:“@”
}
};
});
$scope.questions={
“n3A”:{
“姓名”:“您在旅途中感觉有多安全?”,
“ID”:“n3A”
},
“n3B”:{
“姓名”:“你是怎么到那里的?”,
“ID”:“n3B”
},
})
我也发了一封信。当点击Yes和South America/Asia/Africa时,标题应显示在星星顶部
知道我遗漏了什么吗?您正在使用
scope:{text:'@}
这样,指令就不知道范围是什么
如果将scope
属性从myRating
指令声明中删除,它将起作用