我正在尝试从组件调用控制器的功能。这是我的文件:
控制器.js:
$scope.dataTableDevices = {
title: 'title',
color: {'background' : 'rgb(31, 119, 180)'},
items: [0, 1, 2]
};
$scope.hacerClick = function(){
alert("it works");
}
视图.html:
<device-categories data="dataTableDevices"></device-categories>
deviceCategories.js:
function deviceCategoriesController() {
}
widgetsFactory.component('deviceCategories', {
templateUrl: 'app/common/js/components/deviceCategories/deviceCategories.html',
controller: deviceCategoriesController,
bindings: {
data: '='
}
});
deviceCategories.html:
<md-button ng-click="howToCallhacerClick()">
Click
</md-button>