You May be a SPA if … progressively downloads features as required fully (or mostly) loaded in the initial page load persisting important state on the client maintain navigation, history, deep linking
Stop Me If You’ve Heard this Before • Async services • Client-side application logic • Long-lived client-side state • 2-way data binding (MVVM) • Navigation
var myViewModel = { firstName: ko.observable('John') }; ko.applyBindings(myViewModel); Declarative Binding Create an Observable Connect the ViewModel to the View
Bindings in a View data-bind="value: sessionFilter.searchText, valueUpdate: 'afterkeydown', escape: clearFilter" placeholder="filter by room, speaker, tag, title, or track"/>
Capturing a Route with Sammy sammy.get( '#/sessions/:id', function (context) { vm.callback(context.params); presenter.transitionTo( $(viewName), path ); } ); User Clicks Route 1 Callback fires 2 Call the viewmodel with route parameters 3 Show the View 4
Simplify Data var query = EntityQuery.from('Speakers') .orderBy('lastName, firstName'); return manager.executeQuery(query) .then(querySucceeded) .fail(queryFailed); function querySucceeded(data) { speakers(data.results); } Create a query 1 Execute a query 2 Return data as observables 3