define([ 'dojo/_base/array', 'dojo/_base/declare', 'dojo/_base/lang', 'dojo/when', '../store', '../app/Page', 'dojo/text!./templates/previewSurvey.html' ],function(array,declare,lang,when,store,Page,template){ return declare([Page],{ templateString: template, startup: function() { if ( this._started ) { return; } this.inherited(arguments); if ( this.surveyId ) { when(store.get(this.surveyId)) .then(lang.hitch(this,function(survey){ this.titleNode.innerHTML = survey.title; this.surveyWidget.set('survey',survey); })); } else { throw new Error("No valid uid or survey passed!"); } } }); });