LinkComponent

Ember.LinkComponent Class

PUBLIC

Extends: Ember.Component

Defined in: packages/ember-glimmer/lib/components/link-to.js:329

Module: ember-glimmer

Ember.LinkComponent renders an element whose click event triggers a transition of the application's instance of Ember.Router to a supplied route by name.

Ember.LinkComponent components are invoked with {{#link-to}}. Properties of this class can be overridden with reopen to customize application-wide behavior.

_invoke (event) private

Defined in packages/ember-glimmer/lib/components/link-to.js:613

Event handler that invokes the link, activating the associated route.

Parameters:

event Event

initprivate

Inherited from Ember.ViewMixin but overwritten in packages/ember-glimmer/lib/components/link-to.js:497

An overridable method called when LinkComponent objects are instantiated.

Example:

App.MyLinkComponent = Ember.LinkComponent.extend({
  init: function() {
    this._super(...arguments);
    Ember.Logger.log('Event is ' + this.get('eventName'));
  }
});

NOTE: If you do override init for a framework class like Ember.View, be sure to call this._super(...arguments) in your init declaration! If you don't, Ember may not have an opportunity to do important setup work, and you'll see strange behavior in your application.

clickprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:487

Triggers the LinkComponent's routing behavior. If eventName is changed to a value other than click the routing behavior will trigger on that custom event instead.

activeprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:570

Accessed as a classname binding to apply the LinkComponent's activeClass CSS class to the element when the link is active.

A LinkComponent is considered active when its currentWhen property is true or the application's current route is the route the LinkComponent would trigger transitions into.

The currentWhen property can match against multiple routes by separating route names using the (space) character.

activeClassStringpublic

Defined in packages/ember-glimmer/lib/components/link-to.js:401

The CSS class to apply to LinkComponent's element when its active property is true.

Default: active

attributeBindingsArray | Stringpublic

Inherited from Ember.ViewMixin but overwritten in packages/ember-glimmer/lib/components/link-to.js:446

By default the {{link-to}} component will bind to the href and title attributes. It's discouraged that you override these defaults, however you can push onto the array if needed.

Default: ['title', 'rel', 'tabindex', 'target']

classNameBindingsArraypublic

Inherited from Ember.ClassNamesSupport but overwritten in packages/ember-glimmer/lib/components/link-to.js:458

By default the {{link-to}} component will bind to the active, loading, and disabled classes. It is discouraged to override these directly.

Default: ['active', 'loading', 'disabled', 'ember-transitioning-in', 'ember-transitioning-out']

currentWhenpublic

Inherited from Ember.LinkComponent but overwritten in packages/ember-glimmer/lib/components/link-to.js:356

Used to determine when this LinkComponent is active.

disabledprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:530

Accessed as a classname binding to apply the LinkComponent's disabledClass CSS class to the element when the link is disabled.

When true interactions with the element will not trigger route changes.

disabledClassStringprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:423

The CSS class to apply to a LinkComponent's element when its disabled property is true.

Default: disabled

eventNameStringprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:469

By default the {{link-to}} component responds to the click event. You can override this globally by setting this property to your custom event name.

This is particularly useful on mobile when one wants to avoid the 300ms click delay using some sort of custom tap event.

Default: click

hrefprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:695

Sets the element's href attribute to the url for the LinkComponent's targeted route.

If the LinkComponent's tagName is changed to a value other than a, this property will be ignored.

loadingClassStringprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:412

The CSS class to apply to LinkComponent's element when its loading property is true.

Default: loading

loadingHrefStringprivate

Defined in packages/ember-glimmer/lib/components/link-to.js:779

The default href value to use while a link-to is loading. Only applies when tagName is 'a'

Default: #

relpublic

Defined in packages/ember-glimmer/lib/components/link-to.js:373

Sets the rel attribute of the LinkComponent's HTML element.

Default: null

replaceBooleanpublic

Defined in packages/ember-glimmer/lib/components/link-to.js:435

Determines whether the LinkComponent will trigger routing via the replaceWith routing strategy.

Default: false

tabindexpublic

Defined in packages/ember-glimmer/lib/components/link-to.js:382

Sets the tabindex attribute of the LinkComponent's HTML element.

Default: null

targetpublic

Defined in packages/ember-glimmer/lib/components/link-to.js:391
Available since 1.8.0

Sets the target attribute of the LinkComponent's HTML element.

Default: null

titlepublic

Defined in packages/ember-glimmer/lib/components/link-to.js:364

Sets the title attribute of the LinkComponent's HTML element.

Default: null

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://emberjs.com/api/classes/Ember.LinkComponent.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部