本文整理汇总了TypeScript中@ember/routing/route.extend函数的典型用法代码示例。如果您正苦于以下问题:TypeScript extend函数的具体用法?TypeScript extend怎么用?TypeScript extend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extend函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: debugLogger
hooks.beforeEach(function(this: TestContext) {
this.owner.register('route:application', Route.extend({ debug: debugLogger() }), {});
this.owner.register('service:my/test/module', Service.extend({ debug: debugLogger() }), {});
debug.enable('route:*, service:*');
log = sinon.stub(console, 'log');
});
示例2: beforeModel
import Route from '@ember/routing/route';
import Object from '@ember/object';
import Array from '@ember/array';
import Ember from 'ember'; // currently needed for Transition
interface Post extends Ember.Object {
title: string;
}
interface Posts extends Array<Post> {}
Route.extend({
beforeModel(transition: Ember.Transition) {
this.transitionTo('someOtherRoute');
},
});
Route.extend({
afterModel(posts: Posts, transition: Ember.Transition) {
if (posts.length === 1) {
this.transitionTo('post.show', posts.firstObject);
}
},
});
Route.extend({
actions: {
showModal(evt: { modalName: string }) {
this.render(evt.modalName, {
outlet: 'modal',
into: 'application',