Skip to content

Commit

Permalink
update codes based on new Angular 2 version
Browse files Browse the repository at this point in the history
  • Loading branch information
hongbo-miao authored Aug 4, 2016
1 parent f6fce7f commit 9c6941d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frameworks/angular2.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Make a `feathers.service.ts` file if you haven't already. This will contain the
Let's create a new Angular service that uses REST to communicate with our server. In addition to the packages we previously installed, we also have to include a client REST library. In this guide, we'll be using [Superagent](http://visionmedia.github.io/superagent/).

```ts
import { Injectable } from 'angular2/core';
import { Injectable } from '@angular/core';
const superagent = require('superagent');

const HOST = 'http://localhost:3000'; // Your base server URL here
Expand Down Expand Up @@ -164,7 +164,7 @@ import {MessageService} from '../services/message.service';
Now let's add it as a *provider* to the Angular 2 App Component.

```ts
import {Component} from 'angular2/core';
import {Component} from '@angular/core';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>',
Expand Down Expand Up @@ -228,7 +228,7 @@ And that's it! Our component now has access to our messages via `_messages`. Fro
@Component({
...
template: `
<div class="message" *ngFor="#message of _messages">
<div class="message" *ngFor="let message of _messages">
<h1 class="title">{{message.title}}</h1>
<div class="description">{{message.description}}</div>
</div>
Expand All @@ -242,7 +242,7 @@ There are nicer ways of doing this, but you get the idea. What if we want to rem
@Component({
...
template: `
<div class="message" *ngFor="#message of _messages" (click)="removeMessage(message)">
<div class="message" *ngFor="let message of _messages" (click)="removeMessage(message)">
...
</div>
`,
Expand All @@ -256,4 +256,4 @@ export class AppComponent () {

## Wrapping up

Structuring our interactions with Feathers in this way is very powerful. It allows us to create new services easily with only the methods and behaviors that we need, and inject services only where they are needed. This code is also completely isomorphic, so we can run it on the server or in the client!
Structuring our interactions with Feathers in this way is very powerful. It allows us to create new services easily with only the methods and behaviors that we need, and inject services only where they are needed. This code is also completely isomorphic, so we can run it on the server or in the client!

0 comments on commit 9c6941d

Please sign in to comment.