angular-styleguide
angular-styleguide copied to clipboard
Webstorm's "unresolve function or method" using this styleguide
Hi,
When using the following code, the "getLang" function isn't recognized by WebStorm 11.0
angular.module('app').controller('languageCtrl', languageCtrl); languageCtrl.$inject = []; function languageCtrl() { var vm = this; vm.getLang = getLang; function getLang() {} }
When changing the function name to something else than the controller name (e.g. languageController), the controller method are recognized.
Any idea how to fix this?
What do you mean exactly?
In my case on 11.0.3 work without problem:
angular.module('app').controller('languageCtrl', languageCtrl2);
languageCtrl2.$inject = [];
function languageCtrl2() {
var vm = this;
vm.getLang = getLang;
function getLang() {
}
}
Yes, because you're using "languageCtrl2", that's exactly my problem. If you'll use "languageCtrl" it won't work
@admon-s-waklme : Sorry, but I don't understand your problem.
If I use "languageCtrl"-controller instead of "languageCtrl2", it work on me without problem too.
The function should be added to the body of the activate function. You can always rename activate to getLang but you still need to call/invoke the function, i.e. (). If it still does not work you may want to check your routing.
(function () {
'use strict';
angular
.module('app')
.controller('languageCtrl', languageCtrl);
languageCtrl.$inject = [''];
/* @ngInject */
function languageCtrl() {
var vm = this;
vm.title = 'languageCtrl';
activate(); // or getLang();
////////////////
function activate() { // or function getLang() {
}
}
})();
is this still an issue?