Im facing a serious issue related to ember routes. when i tries to show a single item through link-to helper in ember.js, it works fine and hooks in route for note.index call properly. but when i enter direct url in browser than route hooks are not called and ignored by ember.js, either it is "model" hook or "setupController" hook or any other hook. basically i wants to pass some extra parameters to my rails application with store.find.
Router.js
@resource "assessment", path: 'assessments/:assessment_id', ->
@route 'edit'
@resource "notes", ->
@route "new"
@resource "note", path: "note/:note_id", ->
@route 'edit'
note/index.js
`import Ember from 'ember'`
noteIndexRoute = Ember.Route.extend
model: (params)->
console.log('********************Model Hook******************')
assessment = @modelFor('assessment')
@store.find('note',params.note_id,assessment_id: assessment.get('id')});
setupController: (controller,model)->
@_super controller, model
console.log('********************Setup Contr Hook********************')
assessment = @modelFor('assessment')
controller.set( "model",@store.find('note',model.id,assessment_id: assessment.get('id')});
`export default noteIndexRoute`
Note: i wants to pass some extra parameters to my rails Api thats why i need to call hook on fetching item. URL = localhost:4200/assessment/1/note/1 When i directly enter URL in browser these hooks are ignored.
Aucun commentaire:
Enregistrer un commentaire