I tried myself to do this and I was able to implement it but I couldn't make the test to work. Please refer to this Stackoverflow question: http://stackoverflow.com/questions/20482653/testing-angularjs-scope-variables
This is not going to happen, the main reason is that allowing expressions into ngSwitchWhen will requiere a watch on the expression, and this defeats the entire purpose of ngSwitchWhen
This is not going to happen, the main reason is that allowing expressions into ngSwitchWhen will requiere a watch on the expression, and this defeats the entire purpose of ngSwitchWhen
What about interpolated values which are resolved once (and not watched)? E.g.:
<p ng-switch="error.code">
<p ng-switch-when="{{errors.someErrorCode1}}"></p>
<p ng-switch-when="{{errors.someErrorCode2}}"></p>
...
<p ng-switch-default></p>
</p>
I have string constants in my errors object and want to use those strings to match against with ng-switch-when
. Is this not possible? I don't think ng-messages
has support for a default.
Yeah, would be awesome to have just once-resolved values. Similar use-case for me.
Also useful for supporting TypeScript enums exposed via controller
Even an NgIf/NgElse would solve this, I think.
Most helpful comment
What about interpolated values which are resolved once (and not watched)? E.g.:
I have string constants in my errors object and want to use those strings to match against with
ng-switch-when
. Is this not possible? I don't thinkng-messages
has support for a default.