import ngModule from '../module'; import Section from 'salix/components/section'; class Controller extends Section { constructor($element, $, $stateParams) { super($element, $); this.$stateParams = $stateParams; } $onChanges() { if (this.$stateParams && this.$stateParams.q) this.travel = JSON.parse(this.$stateParams.q); } onSubmit() { return this.$.watcher.submit().then( res => this.$state.go('travel.card.summary', {id: res.data.id}) ); } } Controller.$inject = ['$element', '$scope', '$stateParams']; ngModule.component('vnTravelCreate', { template: require('./index.html'), controller: Controller });