【发布时间】:2018-04-04 01:20:56
【问题描述】:
为什么不输入AddTaskComponentController 并显示我的console.log('TESTE456214651')?代码在同一个存档中,因为我使用的是 grunt。
(function() {
'use strict';
angular.module('dailyTasksApp', []).config(config)
function config($routeProvider, $locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
$routeProvider.when('/', {
templateUrl: 'modules/construction-employees-daily-tasks/app/app.component.html'
}).when('/adicionar-tarefa', {
templateUrl: 'modules/construction-employees-daily-tasks/add-task-component/add-task.component.html'
})
}
})();
(function(){
'use strict';
angular.module('dailyTasksApp').component('addTaskComponent', {
templateUrl: '/modules/construction-employees-daily-tasks/add-task-component/add-task.component.html',
controller: AddTaskComponentController
})
function AddTaskComponentController() {
console.log("TESTE456214651");
}
})();
【问题讨论】:
-
你永远不会调用这个函数。它只是声明的。
标签: javascript angularjs iife