javascript - Possible strict violation one place but not another -


i know there few possible strict violation questions on here, haven't been able come result based on them. trying use var vm = this in controller in 1 class , it's throwing error, have done same thing in other controllers more once no possible strict violation errors.

so here first js file. it's angular directive controller in same file. error coming var vm = this in controller below.

angular.module('app.monitor').directive('scmodellegacyviewer',       scmodellegacyviewer);    function scmodellegacyviewer() {      return {       restrict : 'e',       templateurl : 'app/monitor/monitor.html',       scope : {         config : '=',         register : '&?',         data : '=?',         alloweditingswitch : '=?'       },       controller: scmodellegacyviewercontroller,       controlleras: 'vm'     };   }    scmodellegacyviewercontroller.$inject = [ '$q', '$scope', '$timeout', 'config',                                             'logger', 'projectservice', 'modelservice', 'instanceservice',                                             'bayesianservice'];    function scmodellegacyviewercontroller($q, $scope, $timeout,       config, logger, projectservice,       modelservice, instanceservice, bayesianservice) {       var vm = this;  // here error line       vm.modelinstancechannel = 'model_instance';       vm.saveall = saveall;       ... 

another file works example, throws no errors:

 angular     .module('app.model')     .controller('modelcontroller', modelcontroller);    //scinitialconfig added in model.route.js   modelcontroller.$inject = ['$document', '$interval', '$scope', '$stateparams', 'logger',       'modelservice', 'scinitialconfig'];   /* @nginject */   function modelcontroller($document, $interval, $scope, $stateparams, logger,       modelservice, scinitialconfig) {     var vm = this;     var data = null;     vm.instance = 'default';     vm.title = 'model viewer';     ... 

the difference can come @ top of first file declaring directive in 2nd file controller. unfortunately i'm not angular expert, don't know if issue, thinking might error coming from?

rename function scmodellegacyviewercontroller scmodellegacyviewercontroller. jshint allows assigning variable if name starts capital letter. it's going be

angular.module('app.monitor').directive('scmodellegacyviewer',       scmodellegacyviewer);    function scmodellegacyviewer() {      return {       restrict : 'e',       templateurl : 'app/monitor/monitor.html',       scope : {         config : '=',         register : '&?',         data : '=?',         alloweditingswitch : '=?'       },       controller: scmodellegacyviewercontroller,       controlleras: 'vm'     };   }    function  scmodellegacyviewercontroller() {/*code*/} 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -