Example #1
0
        this.route('post', { path: '/post/:post_id', resetNamespace: true });
        this.route('comments', { resetNamespace: true }, function() {
            this.route('new');
        });
    });
    this.route('photo', { path: '/photo/:id' }, function() {
        this.route('comment', { path: '/comment/:id' });
    });
    this.route('not-found', { path: '/*path' });
    this.mount('my-engine');
    this.mount('my-engine', { as: 'some-other-engine', path: '/some-other-engine'});
});

const RouterServiceConsumer = Ember.Service.extend({
    router: Ember.inject.service('router'),
    transitionWithoutModel() {
        Ember.get(this, 'router')
        .transitionTo('some-route');
    },
    transitionWithModel() {
        const model = Ember.Object.create();
        Ember.get(this, 'router')
        .transitionTo('some.other.route', model);
    },
    transitionWithModelAndOptions() {
        const model = Ember.Object.create();
        Ember.get(this, 'router')
        .transitionTo('index', model, { queryParams: { search: 'ember' }});
    }
});
Example #2
0
        this.route('comments', { resetNamespace: true }, function() {
            this.route('new');
        });
    });
    this.route('photo', { path: '/photo/:id' }, function() {
        this.route('comment', { path: '/comment/:id' });
    });
    this.route('not-found', { path: '/*path' });
    this.mount('my-engine');
    this.mount('my-engine', { as: 'some-other-engine', path: '/some-other-engine'});
});

const RouterServiceConsumer = Ember.Service.extend({
    router: Ember.inject.service('router'),
    currentRouteName() {
        const x: string = Ember.get(this, 'router').currentRouteName;
    },
    currentURL() {
        const x: string = Ember.get(this, 'router').currentURL;
    },
    transitionWithoutModel() {
        Ember.get(this, 'router')
        .transitionTo('some-route');
    },
    transitionWithModel() {
        const model = Ember.Object.create();
        Ember.get(this, 'router')
        .transitionTo('some.other.route', model);
    },
    transitionWithMultiModel() {
        const model = Ember.Object.create();
Example #3
0
import { assertType } from "./lib/assert";

Component.extend({
  layout: hbs`
        <div>
          {{yield}}
        </div>
    `,
});

Component.extend({
  layout: 'my-layout',
});

const MyComponent = Component.extend();
assertType<string | string[]>(Ember.get(MyComponent, 'positionalParams'));

const component1 = Component.extend({
  actions: {
    hello(name: string) {
      console.log('Hello', name);
    },
  },
});

Component.extend({
  name: '',
  hello(name: string) {
    this.set('name', name);
  },
});