Last active
March 23, 2019 07:25
-
-
Save nagarajanpp8/241f70135ae5d32ac1c01fd250db3112 to your computer and use it in GitHub Desktop.
route-transistion-issue-example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import EmberRouter from '@ember/routing/router'; | |
import config from './config/environment'; | |
const Router = EmberRouter.extend({ | |
location: 'none', | |
rootURL: config.rootURL, | |
didTransition(){ | |
this._super(...arguments); | |
console.log("didtransistion router", ...arguments); | |
return true; | |
} | |
}); | |
Router.map(function() { | |
this.route('report', { path: 'reports/:reportId/' }); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
actions:{ | |
didTransition(){ | |
//this._super(...arguments); | |
console.log("didtransistion application route", ...arguments); | |
return true; | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import { task, timeout } from 'ember-concurrency'; | |
const dataObj1 = {"id":1, "data": [] }; | |
export default Ember.Route.extend({ | |
model(params){ | |
console.log("report model params", params); | |
let dataObj = Ember.Object.create({"id":1, "data": [] }); | |
//Ember.set(dataObj, "instance", this.get("getData").perform()); | |
return dataObj; | |
}, | |
getData: task(function *(){ | |
//yield timeout(1000); | |
let temp = [], length = 5; | |
for(let i =0; i < length; i++){ | |
temp.push(this.getGuid()); | |
} | |
//this.setData(temp); | |
//Ember.set(dataObj, "data", temp); | |
return ['f2f07dc6-3f05-2dc1-ce6e-a607f85eb012']; | |
}).restartable(), | |
setData(promise){ | |
//let controller = this.controllerFor(this.routeName); | |
//let dataObj = Ember.Object.create({"id":1, "data": promise }); | |
//console.log("controller for", controller); | |
//this.controller.model.set("data", promise); | |
//controller.set("model", dataObj); | |
}, | |
getGuid(){ | |
function _p8(s) { | |
var p = (Math.random().toString(16) + "000000000").substr(2, 8); | |
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p; | |
} | |
return _p8() + _p8(true) + _p8(true) + _p8(); | |
}, | |
actions:{ | |
didTransition(transition){ | |
//this._super(...arguments); | |
console.log("didtransistion report route", ...arguments); | |
// transition.retry(); | |
return true; | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "2.14.1", | |
"ember-template-compiler": "2.14.1", | |
"ember-testing": "2.14.1" | |
}, | |
"addons": { | |
"ember-data": "2.14.10", | |
"ember-concurrency": "0.7.19" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment