Hedge
Hedge

Reputation: 16768

Updating permalink-property of object also updates URL in browser?

I've created an editor for my posts using this URL scheme

http://localhost:4200/admin/edit-post/post-permalink

You can change post-permalink via ember's input-helper.

{{input type="text" value=permalink}}

How can I at the same time alter the URL in the browser to reflect the altered permalink?

Upvotes: 1

Views: 75

Answers (1)

Hedge
Hedge

Reputation: 16768

Thanks to the comment of @andrusieczko I was able to solve this problem myself by reading the documentation http://emberjs.com/guides/routing/query-params/ :)

import Ember from 'ember';
export default Ember.ObjectController.extend({

permalinkChanged: function() {
   this.transitionToRoute("/admin/posts/edit/" + this.get('permalink'))
}.observes('permalink')

Note: I used an observer to the value instead of an action-helper because key-press changes the value after triggering the action.

Upvotes: 1

Related Questions