Search code examples
angularjstypescriptwebstorm

AngularJS syntax error after moving from Visual Studio to WebStorm (Typescript coded)


I have just moved my Typescript / AngularJS application from Visual Studio to WebStorm. Some of the code that was working before now gives an error as below:

 <div class="flexUserLogin"
     ng-controller="authenticationHomeController"
     style="flex-direction: column;
            flex: 1;
            margin-left: 3rem;">

    <div class="authTabs">
        <div class="w2r"></div>
        <div id="login" class="h2"
             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);
    }
}

Update:

I noticed changing to $scope.bs and then changing the references in the html to "bs" works okay. "as" is not a reserved word so I'm curious if anyone else has seen this and had it as a problem.


Solution

  • Logged as WEB-14555, please vote