0
module.exports =()=>{
return {
restrict: 'E',
templateUrl: "/components/event/event.html",
scope: {index: '@'},
controller: "eventCtrl"
};
};
守则控制器
module.exports = ($scope)=>{
console.log($scope.index);
$scope.loadDetails =()=>{
console.log("hello there");
}
};
和模板
.event
h3(ng-bind="index.title")
p(ng-bind="index.description")
.price(ng-show="index.is_paid") {{cost}} $
a.button-primary(ng-click="loadDetails()") Details
问题是变量未在模板被渲染。我测试了是否使用console.log
正确传递,我正在得到正确的回应。此外功能loadDetails()
正常工作,使我相信设置控制器没有问题。我究竟在哪里出错?
控制台日志是杜绝他们作为字符串? –
原因@ ..不是为字符串值吗? –
它的json对象 – georoot