2017-10-23 13 views
0

AddTaskComponentController을 입력하고 console.log('TESTE456214651')을 표시하지 않으시겠습니까? 코드는 동일한 아카이브에 있습니다. 왜냐하면 내가 쓸데없는 것을 사용하기 때문입니다.Angular.js - 컨트롤러 내부에 입력하지 않음

(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"); 
    } 
})(); 
+1

절대로 함수를 호출하지 마십시오. 단지 선언되었습니다. – JustinJmnz

답변

0

각도 조절기로 기능을 선언해야합니다.

(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') 
     .controller('AddTaskComponentController', 
      function(){ 
       console.log("TESTE456214651"); 
      }) 
     .component('addTaskComponent', { 
      templateUrl: '/modules/construction-employees-daily-tasks/add-task-component/add-task.component.html', 
      controller: AddTaskComponentController 
     }) 

})();