0

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.

3
  • Maybe a bug in WebStorm? Just curious -- does it go away if you use the controllerAs syntax instead of adding the as to the scope? Commented Dec 12, 2014 at 15:46
  • I just noticed it seems upset with the word "as". Changing that to "bs" or anything else and it works fine. Commented Dec 12, 2014 at 15:49
  • now I am convinced it's a WebStorm bug. Please submit it to them. Commented Dec 12, 2014 at 15:52

1 Answer 1

2

Logged as WEB-14555, please vote

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.