Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attribute ng-model not allowed here

I am trying to use the ng-model attribute on a dropdown, however WebStorm keeps telling that it is not allowed. When I run the app, it is not bound so I thinking it has do with my Angular version. I am running the latest version, and ng-model seems to work on all other elements besides select. Has something changed within the last update?

<div class="form-group">
    <label for="selectPost" class="control-label">Posts</label>
    <select ng-model="post" class="form-control" id="selectPost" >
        <option ng-repeat="post in currentUser.posts" value="{{post._id}}">
            {{post.name}}
        </option>
    </select>
</div>
like image 753
njthoma Avatar asked Aug 02 '15 17:08

njthoma


2 Answers

change ng-model into data-ng-model, it is a known WebStorm bug

like image 171
A-S Avatar answered Nov 01 '22 14:11

A-S


This may not be the solution to your problem, but I was getting "not allowed here" for a lot Angular attributes inexplicably.

It turned out that I had excluded the folder that included the angular.js from my project so that it didn't bother me with my normal day to day. It meant that the page worked fine when created but Webstorm wasn't able to read it as I was writing the code

like image 28
Keith McNamee Avatar answered Nov 01 '22 14:11

Keith McNamee