Webstorm is reporting an AngularJS syntax error when using the word "as" in an expression? Follow
Our team just moved a Typescript / AngularJS application from Visual Studio to WebStorm. Some of the code that was working before now gives an error as below: <div ng-controller="authenticationHomeController" style="flex-direction: column; flex: 1; margin-left: 3rem;"> <div > <div ></div> <div id="login" ng-class="{'enabled':as.authTab == AuthTabs.Login, 'disabled': as.authTab != AuthTabs.Login}" ng-click="as.setAuthTab(AuthTabs.Login)"> WebStorm is showing a red syntax error and saying "Expecting an expression" for the code area `as.authTab` Here's the controller: class AuthenticationHomeController { static $inject = [ "$scope", "authService" ]; constructor( public $scope, public as:IAuthService ) { $scope.as = as; as.setAuthTab(AuthTabs.Login); } }
The error can be fixed by changing the $scope.as = as to $scope.bs = as and then chaning the HTML to show bs.authTab
For some reason WebStorm does not like the word "as".
Can you let me know if this is a bug. The issue was opened on Stack Overflow and one of the members there suggested this was probably a bug with WebStorm
Please sign in to leave a comment.
it's a bug, https://youtrack.jetbrains.com/issue/WEB-14555