0
프론트 엔드의 arround 각도를 이해하려고합니다. 나는 yeaman 제너레이터를 사용하여 각/꿀꺽 꿀꺽한 프로젝트를 만듭니다.
PS P:\projects\trax> gulp test
[19:35:22] Using gulpfile P:\projects\trax\gulpfile.js
[19:35:22] Starting 'scripts'...
[19:35:30]
P:\projects\trax\src\app\components\head\user\menu.dialog.controller.js
7:9 error "vm" is defined but never used no-unused-vars
10:5 error You should not set properties on $scope in controllers. Use controllerAs syntax and add data to "this" angular/controller-as
14:5 error You should not set properties on $scope in controllers. Use controllerAs syntax and add data to "this" angular/controller-as
18:5 error You should not set properties on $scope in controllers. Use controllerAs syntax and add data to "this" angular/controller-as
✖ 4 problems (4 errors, 0 warnings)
[19:35:30] all files 14.79 kB
[19:35:30] Finished 'scripts' after 7.75 s
[19:35:30] Starting 'test'...
28 11 2017 19:35:33.855:WARN [proxy]: proxy "\base\src\assets\" normalized to "\base\src\assets\/"
28 11 2017 19:35:35.077:WARN [watcher]: Pattern "P:/projects/trax/src/**/*.mock.js" does not match any file.
PhantomJS 1.9.8 (Windows 8 0.0.0): Executed 1 of 1 SUCCESS (0.032 secs/0.34 secs)
[19:35:38] Finished 'test' after 8.1 s
그것은 실행하지만 난 LINT 경고를 방지하기 위해 싶습니다
이
내 문제입니다. 방법? 나는 메시지를 이해하지만 언급대로 대체하면 오류가 발생합니다.이것은 위에서 언급 한 파일의 코드입니다.
angular
.module('trax')
.controller('MenuDialogController', MenuDialogController);
function MenuDialogController($scope, $mdDialog) {
var vm = this;
$scope.close = function close(){
$mdDialog.hide();
}
$scope.cancel = function cancel(){
$mdDialog.hide();
}
$scope.ok = function ok(){
alert('ok clicked');
$mdDialog.hide();
}
}
그리고 이것은 대화 함수 userController 개방 컨트롤러 ($ 범위, $ mdDialog, $ 문서) {
var vm = this;
vm.user = {
name: 'Test User'
};
vm.showMenu = function showMenu(ev){
$mdDialog.show({
controller: "MenuDialogController",
controllerAs: 'vm',
templateUrl: 'app/components/head/user/menu.dialog.html',
parent: angular.element($document.body),
targetEvent: ev,
clickOutsideToClose:true,
fullscreen: $scope.customFullscreen // Only for -xs, -sm breakpoints.
});
};
}
}
제가 $ scope.close =로 바와 같은 방법을 변경하면 ... LINT에서 경고를 방지 할 수 있지만 대화 방법은 더 이상 작동하지 않습니다.
모든 힌트 ...? 감사 n00n
thx ... 나는 종종 각도를 찾는 동안 문제를 해결하기 위해 일을 찾습니다. 대부분 나는 그런 작은 것들을 보지 못한다 ... – n00n