Is there a way to disable a button based on the state of my view model?
In AngularJS:
<button class="btn" ng-click="Search()" ng-hide="canRefresh()" ng-disabled="query.trim().length == 0">
<i class="icon-search"></i> Search</button>
How do I do this with Dart’s Web UI package?
(credit to John Saturnus for the question)
Yes – we made it such that using a binding directly in the ‘disabled’ attribute does what you want. So you can write:
Note that this only works if you are using a data-binding, using ‘disabled=”false”‘ will still show the button in a disabled state. You can read some additional details in the discussion about “boolean attributes” here: http://www.dartlang.org/articles/dart-web-components/spec.html#binding-in-attributes
(credit to Siggi Cherem for the answer)