Skip to content

Instantly share code, notes, and snippets.

@mhevery
Last active December 26, 2015 04:19
Show Gist options
  • Save mhevery/7092098 to your computer and use it in GitHub Desktop.
Save mhevery/7092098 to your computer and use it in GitHub Desktop.
When you go to bleeding edge you should change to:
@NgController {
selector: '[ng-controller=AppointmentCtrl]',
publishAs: 'ctrl'
}
class AppointmentCtrl {
String appointmentText = '';
List appointments = [{'time': '08:00', 'title': 'Wake Up'}];
addAppointment() {
var newAppt = fromText(appointmentText);
appointments.add(newAppt);
appointmentText = '';
};
}
Then template to:
<div ng-controller=AppointmentCtrl>
<ul class="unstyled">
<li ng-repeat="appt in ctrl.appointments">
{{appt.time}} {{appt.title}}
</li>
</ul>
<form ng-submit="ctrl.addAppointment" class="form-inline">
<input type="text" ng-model="ctrl.appointmentText" size="30"
placeholder="15:00 Learn Dart">
<input class="btn-primary" type="submit" value="add">
</form>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment