lundi 28 novembre 2016

ember route params lost after this.refresh()

In my route, I refresh the page after I update the date, but after refreshing, the params in the url lost.

the url before is like:http://localhost:4200/#/ss/xxx?id=1

the url after is like:http://localhost:4200/#/ss/xxx

the param is important because I need it in my server.

the front script is as follow:

import Ember from 'ember';
export default Ember.Route.extend({
    loginInfo: Ember.inject.service(),
    model: function() {
        return this.store.query('my-stablity-project', {
            creator: this.get('loginInfo').get('staffId'),
            bizId:this.getQueryString("bizId")
        });
    },
    setupController: function(controller, model) {
        this._super(controller, model);
        controller.set('my-project', model);
        let array = model.toArray();
        var str = '';
        for (var i = 0; i < array.length; i++) {
            str += array[i].get('keludeId') + ',';
        }
        this.store.query('kelude-result', {
            keludeIds: str
        }).then(results => {
            controller.set('kelude-result', results);
        });
        this.store.query('kelude-week-result', {
            keludeIds: str
        }).then(results => {
            controller.set('kelude-week-result', results);
        });
    },
    actions: {
        findProjects: function(projectId) {
            this.store.query('kelude-project', {
                projectId: projectId
            });
        },
        updateMySub: function() {
            this.refresh();
        }
    }
});

This situation happens when the action updateMySub is executed.




Aucun commentaire:

Enregistrer un commentaire