# Routing and linking in EmberCLI

**URL:** https://discuss.emberjs.com/t/routing-and-linking-in-embercli/10474
**Category:** Uncategorized
**Created:** [April 18, 2016, 9:14pm UTC](https://discuss.emberjs.com/t/routing-and-linking-in-embercli/10474 "2016-04-18T21:14:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![r0uder](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@r0uder](https://discuss.emberjs.com/u/r0uder)
#### Post date: [April 18, 2016, 9:14pm UTC](https://discuss.emberjs.com/t/routing-and-linking-in-embercli/10474/1 "2016-04-18T21:14:21Z")

</div>

I have a Rails API and EmberCLI frontend app. My page shows a list of artists. Click on artist should send user on page with all albums of the artist. I need to make a link to user’s albums page. Each artist has his own page with albums. Like localhost:4200/artists/1. Here’s what I have: My router:

```
import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('artists');
  this.route('artist', { path: 'artist/:artist_id' });
});

export default Router;

```

model Artist:

```
import DS from 'ember-data';

export default DS.Model.extend({
  name: DS.attr('string'),
  itunes_id: DS.attr('number'),
  albums: DS.hasMany('album')

});

```

model Album:

```
import Model from 'ember-data/model';
import DS from 'ember-data';

export default Model.extend({
  name: DS.attr('string'),
  artwork_url_100: DS.attr('string'),
  artist_id: DS.attr('number'),
  artist: DS.belongsTo('artist')

});

```

Routes: 1)artist.js

```
import Ember from 'ember';

export default Ember.Route.extend({
  model() {
    return this.store.findAll('artist')
    return this.store.findRecord('artist', params.artist_id);}
    });

```

1. album.js

---

<div class="post-metadata">

### Author: ![acorncom](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/acorncom/32/12198_2.png) [@acorncom](https://discuss.emberjs.com/u/acorncom)
#### Post date: [April 19, 2016, 4:33am UTC](https://discuss.emberjs.com/t/routing-and-linking-in-embercli/10474/2 "2016-04-19T04:33:50Z")

</div>

Not sure I see a question here yet 🙂

---

<div class="post-metadata">

### Author: ![Photon79](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/photon79/32/12058_2.png) [@Photon79](https://discuss.emberjs.com/u/Photon79)
#### Post date: [April 20, 2016, 8:38am UTC](https://discuss.emberjs.com/t/routing-and-linking-in-embercli/10474/3 "2016-04-20T08:38:24Z")

</div>

This code need to throw out
