I'm using Ember-cli with ember 1.11
I'm trying to use the transitionToRoute method in a controller to transition to a route and feed it a dynamically generated object as the model.
Here's my controller:
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
launch_scanner: function(){
console.log('launch_scanner');
var model = {name: "Edward", phone: "123", email: "[email protected]"};
//the final app will pull the model variable from a QR scanner
this.transitionToRoute('addcontact', model);
}
}
});
When I trigger this action, the transitionToRoute method causes this error:
Uncaught Error: More context objects were passed than there are dynamic segments for the route: addcontact
If I leave out the model parameter, it transitions to the addcontact route just fine. What am I doing wrong?
Here is my router file:
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('home', {path: '/'});
this.resource('addcontact', {path: '/addcontact'});
});
export default Router;