# ember-cli-smart-link-to

> Component to handle either URLs/paths or routes as link-to helper.

Latest version **2.1.0** (published 2016-11-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-cli-smart-link-to
pnpm add ember-cli-smart-link-to
yarn add ember-cli-smart-link-to
bun add ember-cli-smart-link-to
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2016-11-18 |
| First published | 2015-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | gczene |
| Keywords | ember-addon |

## Links

- npm: https://www.npmjs.com/package/ember-cli-smart-link-to
- npm.io page: https://npm.io/package/ember-cli-smart-link-to

## Dependencies (2)

- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^5.1.6
- [ember-cli-htmlbars](https://npm.io/package/ember-cli-htmlbars.md) ^1.0.3

## Recent versions

- 2.1.0 (latest) — 2016-11-18
- 2.0.0 — 2016-11-18
- 1.0.1 — 2016-10-16
- 1.0.0 — 2016-05-11
- 0.0.3 — 2015-09-29
- 0.0.2 — 2015-06-06
- 0.0.1 — 2015-06-06

## README

[![Build Status](https://travis-ci.org/travis-ci/travis-web.svg?branch=master)](https://travis-ci.org/travis-ci/travis-web)

# Ember-cli-smart-link-to

Component to handle external URLs/paths not just routes as link-to helper.

Example problem to resolve: given an array of objects where a `link` property can contain either route or URL. If not a route is passed to `{{link-to}}` that would throw an error.

**Important**

This component uses block form.

## Usage:
```html
          {{#smart-link-to label="Tell me more" link=myLink}}
            <i class="fa fa-angle-right"></i>
          {{/smart-link-to}}
```
The string in the **block form** is passed before the `<a></a>` tag. See below:


## Output
If `myLink` in the previous example is an existing route, e.g. in your router.js:
```javascript
//router.js
  this.route('myRoute', {path: '/itIsMyPath'});
```

will be rendered as

```html
<a href="/itIsMyPath">
  <i class="fa fa-angle-right"></i>
  Tell me more
</a>
```
If it is `not` an existing route it will render the usual `<a>` tag.

## Options:

Option  | Description
------------- | -------------
target  | target attribute for `<a>` tag.
cssClass  | added to `<a class="">` attribute



## Installation

* `ember install ember-cli-smart-link-to`

## Running

* `ember server`
* Visit your app at http://localhost:4200.

## Running Tests

* `ember test`
* `ember test --server`

## Building

* `ember build`

For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).

---
_Source: https://npm.io/package/ember-cli-smart-link-to · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
