Skip to content

Commit fac2e2e

Browse files
committed
Merge branch 'gh-pages' of github.com:tjvantoll/nativescript-angular-guide into gh-pages
2 parents bc6bc01 + 57f4a3b commit fac2e2e

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

images/chapter3/login_router.gif

21.6 KB
Loading

src/chapters/chapter2.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ This file contains an Angular 2 component, which is the primary building block o
114114

115115
First, you again use TypeScript’s `import` command to bring in externally defined functionality—in this case, the `Component` class from Angular 2 itself. In Angular 2 a component manages a view, or a piece of the user interface that the user sees. A component can be used to define an individual UI element, or an entire page, and eventually we’ll add a bunch of logic to these components and use them to build an entire app. But for now this component is simple for the purpose of demonstration.
116116

117+
> **TIP**: Why [TypeScript](http://www.typescriptlang.org/)? It's strongly recommended that you use TypeScript in your Angular 2 NativeScript app, as it's a first class citizen in both NativeScript and Angular 2. In fact, both NativeScript and Angular 2 were built with TypeScript. The NativeScript CLI makes compiling your TypeScript files seamless, as each time you livesync, run or build the app, the files are recompiled from TypeScript to JavaScript. In some IDEs, such as Visual Studio Code, you might choose to hide the compiled files. A tutorial on how to do this can be found [here](https://code.visualstudio.com/Docs/languages/typescript#_hiding-derived-javascript-files).
118+
117119
Notice the interesting way that the `Component` class is used—with the syntax `@Component`. This is a [TypeScript decorator](https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Decorators.md), which allows you to annotate a TypeScript class or method with additional information. For now, you can think of it as a way of adding some metadata configuration to the currently empty `AppComponent` class. Specifically, the `@Component` decorator’s `template` property tells NativeScript how to render this component on the screen. In fact, the `<Label text="hello NativeScript"></Label>` syntax is why you saw “hello NativeScript” when you ran this app earlier.
118120

119121
However, this syntax may look a bit odd if you come from a web development background. On the web, the `<label>` HTML element doesn’t have a `text` attribute, so why do we see it here? Let’s dive into this by looking at how NativeScript UI elements work.

src/chapters/chapter3.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,10 @@ constructor(private _router: Router, private _userService: UserService) {
604604
605605
<div class="exercise-end"></div>
606606
607-
You can login now! And navigate! Show a gif of the navigation. Talk about how in NativeScript you get native behavior automatically—aka a back button on iOS and a hardware back button on Android.
607+
You can login now! And navigate!
608+
609+
<img alt="Login with basic information" src="images/chapter3/login_router.gif" class="plain">
610+
611+
Talk about how in NativeScript you get native behavior automatically—aka a back button on iOS and a hardware back button on Android.
608612
609613
Then transition to modules.

0 commit comments

Comments
 (0)