1

Can I add HTML attributes dynamically through ng-repeat?

<select>
    <option ng-repeat="thing in things" {{thing.ghosted||'disabled'}}>
        {{thing.name}}
    </option>
</select>

What am I doing wrong here?

1 Answer 1

3

For something like this, it'd be good to use a directive.

<select>
    <option ng-repeat="thing in things" ng-disabled="thing.ghosted">
        {{thing.name}}
    </option>
</select>
Sign up to request clarification or add additional context in comments.

1 Comment

+1 I knew but didn't understand {{thing.ghosted||'disabled'}} meaning

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.