Skip to content

Tips Tricks

jokade edited this page May 28, 2015 · 1 revision
Use js.UndefOr[T] for vars bound to input fields
<div ng-controller="FooCtrl as ctrl">
  <input type="text" ng-model="ctrl.foo">
</div>
FooCtrl extends Controller {
  var foo: UndefOr[String] = ""
}

Otherwise, an exception might be thrown when the input field is cleared.

Clone this wiki locally