|
|
|
@ -67,7 +67,7 @@ The following table lists some of the key AngularJS template features with their
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bindings/interpolation
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
Your favorite hero is: {{vm.favoriteHero}}
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -85,7 +85,7 @@ The following table lists some of the key AngularJS template features with their
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bindings/interpolation
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.html" region="interpolation" title="ajs-quick-reference/src/app/movie-list.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.html" region="interpolation" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -107,7 +107,7 @@ The following table lists some of the key AngularJS template features with their
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Filters
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<td>{{movie.title | uppercase}}</td>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -121,7 +121,7 @@ The following table lists some of the key AngularJS template features with their
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Pipes
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="uppercase" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="uppercase" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -141,7 +141,7 @@ The following table lists some of the key AngularJS template features with their
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Local variables
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<tr ng-repeat="movie in vm.movies">
|
|
|
|
|
<td>{{movie.title}}</td>
|
|
|
|
|
</tr>
|
|
|
|
@ -155,7 +155,7 @@ The following table lists some of the key AngularJS template features with their
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Input variables
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="local" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="local" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -210,7 +210,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-app
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<body ng-app="movieHunter">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -226,11 +226,11 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bootstrapping
|
|
|
|
|
<code-example path="ajs-quick-reference/src/main.ts" title="main.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/main.ts" title="main.ts" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
<br>
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.module.1.ts" title="app.module.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.module.1.ts" title="app.module.ts" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -251,7 +251,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-class
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<div ng-class="{active: isActive}">
|
|
|
|
|
<div ng-class="{active: isActive,
|
|
|
|
|
shazam: isImportant}">
|
|
|
|
@ -272,7 +272,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ngClass
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="ngClass" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="ngClass" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -300,7 +300,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-click
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<button ng-click="vm.toggleImage()">
|
|
|
|
|
<button ng-click="vm.toggleImage($event)">
|
|
|
|
|
</code-example>
|
|
|
|
@ -318,7 +318,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bind to the `click` event
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="event-binding" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="event-binding" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -351,7 +351,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-controller
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<div ng-controller="MovieListCtrl as vm">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -365,7 +365,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Component decorator
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.ts" region="component" title="ajs-quick-reference/src/app/movie-list.component.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.ts" region="component" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -405,7 +405,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-href
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<a ng-href="angularDocsUrl">Angular Docs</a>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -415,7 +415,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
fetches from that URL.
|
|
|
|
|
|
|
|
|
|
In AngularJS, the `ng-href` is often used to activate a route as part of navigation.
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<a ng-href="#movies">Movies</a>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -427,7 +427,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bind to the `href` property
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="href" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="href" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -439,7 +439,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
section of the [Template Syntax](guide/template-syntax) page.
|
|
|
|
|
|
|
|
|
|
In Angular, `href` is no longer used for routing. Routing uses `routerLink`, as shown in the following example.
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="router-link" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="router-link" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -457,7 +457,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-if
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<table ng-if="movies.length">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -472,7 +472,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### *ngIf
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.html" region="ngIf" title="ajs-quick-reference/src/app/movie-list.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.html" region="ngIf" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -494,7 +494,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-model
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<input ng-model="vm.favoriteHero"/>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -507,7 +507,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ngModel
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.html" region="ngModel" title="ajs-quick-reference/src/app/movie-list.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.html" region="ngModel" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -528,7 +528,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-repeat
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<tr ng-repeat="movie in vm.movies">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -543,7 +543,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### *ngFor
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.html" region="ngFor" title="ajs-quick-reference/src/app/movie-list.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.html" region="ngFor" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -569,7 +569,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-show
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<h3 ng-show="vm.favoriteHero">
|
|
|
|
|
Your favorite hero is: {{vm.favoriteHero}}
|
|
|
|
|
</h3>
|
|
|
|
@ -586,7 +586,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bind to the `hidden` property
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.html" region="hidden" title="ajs-quick-reference/src/app/movie-list.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.html" region="hidden" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -611,7 +611,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-src
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<img ng-src="{{movie.imageurl}}">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -625,7 +625,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bind to the `src` property
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="src" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="src" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -645,7 +645,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-style
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<div ng-style="{color: colorPreference}">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -662,7 +662,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ngStyle
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="ngStyle" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="ngStyle" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -688,7 +688,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ng-switch
|
|
|
|
|
<code-example format="">
|
|
|
|
|
<code-example hideCopy format="">
|
|
|
|
|
<div ng-switch="vm.favoriteHero &&
|
|
|
|
|
vm.checkMovieHero(vm.favoriteHero)">
|
|
|
|
|
<div ng-switch-when="true">
|
|
|
|
@ -717,7 +717,7 @@ The following are some of the key AngularJS built-in directives and their equiva
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ngSwitch
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.html" region="ngSwitch" title="ajs-quick-reference/src/app/movie-list.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.html" region="ngSwitch" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -784,7 +784,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### currency
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<td>{{movie.price | currency}}</td>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -796,7 +796,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### currency
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="currency" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="currency" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -812,7 +812,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### date
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<td>{{movie.releaseDate | date}}</td>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -824,7 +824,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### date
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="date" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="date" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -841,7 +841,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### filter
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<tr ng-repeat="movie in movieList | filter: {title:listFilter}">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -865,7 +865,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### json
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<pre>{{movie | json}}</pre>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -877,7 +877,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### json
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="json" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="json" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -893,7 +893,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### limitTo
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<tr ng-repeat="movie in movieList | limitTo:2:0">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -906,7 +906,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### slice
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="slice" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="slice" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -925,7 +925,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### lowercase
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<div>{{movie.title | lowercase}}</div>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -937,7 +937,7 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### lowercase
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="lowercase" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="lowercase" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -953,7 +953,8 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### number
|
|
|
|
|
<code-example>
|
|
|
|
|
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<td>{{movie.starRating | number}}</td>
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -965,7 +966,8 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### number
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.component.html" region="number" title="ajs-quick-reference/src/app/app.component.html" linenums="false">
|
|
|
|
|
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.component.html" region="number" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -986,7 +988,8 @@ For more information on pipes, see [Pipes](guide/pipes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### orderBy
|
|
|
|
|
<code-example>
|
|
|
|
|
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<tr ng-repeat="movie in movieList | orderBy : 'title'">
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1055,7 +1058,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### IIFE
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
(function () {
|
|
|
|
|
...
|
|
|
|
|
}());
|
|
|
|
@ -1086,7 +1089,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Angular modules
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
angular.module("movieHunter", ["ngRoute"]);
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1099,7 +1102,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Angular modules
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/app.module.1.ts" title="ajs-quick-reference/src/app/app.module.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/app.module.1.ts" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1120,7 +1123,8 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Controller registration
|
|
|
|
|
<code-example>
|
|
|
|
|
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
angular
|
|
|
|
|
.module("movieHunter")
|
|
|
|
|
.controller("MovieListCtrl",
|
|
|
|
@ -1140,7 +1144,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Component decorator
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.ts" region="component" title="ajs-quick-reference/src/app/movie-list.component.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.ts" region="component" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1163,7 +1167,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Controller function
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
function MovieListCtrl(movieService) {
|
|
|
|
|
}
|
|
|
|
|
</code-example>
|
|
|
|
@ -1176,7 +1180,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Component class
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.ts" region="class" title="ajs-quick-reference/src/app/movie-list.component.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.ts" region="class" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1197,7 +1201,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Dependency injection
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
MovieListCtrl.$inject = ['MovieService'];
|
|
|
|
|
function MovieListCtrl(movieService) {
|
|
|
|
|
}
|
|
|
|
@ -1215,7 +1219,7 @@ The Angular code is shown using TypeScript.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Dependency injection
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.ts" region="di" title="ajs-quick-reference/src/app/movie-list.component.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.ts" region="di" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1277,7 +1281,7 @@ also encapsulate a style sheet within a specific component.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Link tag
|
|
|
|
|
<code-example>
|
|
|
|
|
<code-example hideCopy>
|
|
|
|
|
<link href="styles.css" rel="stylesheet" />
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1290,7 +1294,7 @@ also encapsulate a style sheet within a specific component.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Link tag
|
|
|
|
|
<code-example path="ajs-quick-reference/src/index.html" region="style" title="ajs-quick-reference/src/index.html" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/index.html" region="style" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
@ -1301,7 +1305,7 @@ also encapsulate a style sheet within a specific component.
|
|
|
|
|
### StyleUrls
|
|
|
|
|
In Angular, you can use the `styles` or `styleUrls` property of the `@Component` metadata to define
|
|
|
|
|
a style sheet for a particular component.
|
|
|
|
|
<code-example path="ajs-quick-reference/src/app/movie-list.component.ts" region="style-url" title="ajs-quick-reference/src/app/movie-list.component.ts" linenums="false">
|
|
|
|
|
<code-example hideCopy path="ajs-quick-reference/src/app/movie-list.component.ts" region="style-url" linenums="false">
|
|
|
|
|
|
|
|
|
|
</code-example>
|
|
|
|
|
|
|
|
|
|