为什么会出现此错误错误:使用以下指令的ng:areq错误参数?
(function () {
'use strict';
angular.module('app.home')
.directive ('centerTabs', {
restrict: 'E',
templateUrl: 'app/home/directives/html/center-tabs.template.html',
controller: centerTabsController,
controllerAs: 'centerTab',
scope: {
accountList: '=',
emailsOpened: '=',
contractsOpened: '='
}
});
function centerTabsController() {...
这是下面的HTML模板中的内容:
<center-tabs
account-list="home.accountList"
emails-opened="home.emailsOpened"
contracts-opened="home.contractsOpened"
layout="row" flex>
</center-tabs>
答案 0 :(得分:0)
您能不能像这样重组指令,也许是语法错误?
更改是将属性包装在一个对象中并在指令内返回!
var app = angular.module('myApp', []);
app.controller('MyController', function MyController($scope) {
});
app.directive('centerTabs', function() {
return {
restrict: 'E',
// templateUrl: 'app/home/directives/html/center-tabs.template.html',
template: '<h1>hello!</h1>',
controller: function(){},
controllerAs: 'centerTab',
scope: {
accountList: '=',
emailsOpened: '=',
contractsOpened: '='
}
};
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ng-controller='MyController' ng-app="myApp">
<center-tabs account-list="home.accountList" emails-opened="home.emailsOpened" contracts-opened="home.contractsOpened" layout="row" flex>
</center-tabs>
</div>