You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.html
+15-6Lines changed: 15 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ <h3 id="what-is-nativescript-what-is-angular-2-">What is NativeScript? What is A
49
49
</div>
50
50
51
51
<blockquote>
52
-
<p><strong>TIP</strong>: Using Angular 2 with NativeScript is optional. If you’re looking for a guide on how to use NativeScript without Angular 2, head over to our other <ahref="http://docs.nativescript.org/start/getting-started">Getting Started Guide</a>.</p>
52
+
<p><strong>TIP</strong>: Using Angular 2 with NativeScript is optional. If you’re looking for a tutorial on how to use NativeScript without Angular 2, head over to our other <ahref="http://docs.nativescript.org/start/getting-started">Getting Started Guide</a>.</p>
<p>This guide will walk you through building <ahref="https://github.com/NativeScript/sample-Groceries">Groceries</a>, a groceries management app that does the following things:</p>
<p>Open <code>app/pages/login/login.component.ts</code> and add the following line at the top:</p>
1106
+
<p>Next, open <code>app/pages/login/login.component.ts</code> and add the following line at the top, which imports the <ahref="http://docs.nativescript.org/ApiReference/color/Color.html"><code>Color</code> class</a> from the NativeScript color module:</p>
1106
1107
<pre><codeclass="lang-TypeScript">import {Color} from "color";
1107
1108
</code></pre>
1108
-
<p>Change the <code>toggleDisplay()</code> function in the same file to look like this:</p>
1109
+
<p>Finally, change the <code>LoginPage</code>’s <code>toggleDisplay()</code> function in the same file to use this code:</p>
<p>Talk about the color module and animation module. Have gifs. Mention that the hint color looks bad, but that we’ll address that later. Transition to talking about the list page.</p>
1120
+
<p>All NativeScript UI elements inherit from a base <ahref="http://docs.nativescript.org/ApiReference/ui/core/view/View.html"><code>View</code> class</a>, which contains a number of useful methods—including the <code>getViewById()</code> and <code>animate()</code> methods used in the previous example. The <code>getViewById()</code> method, as its name implies, allows you to get a reference to a child view by its <code>id</code> attribute.</p>
1121
+
<p>One you have a reference to a UI element, you can call any of the methods that element inherits from <code>View</code>. In this case, you call the <code><StackLayout id="container"></code> element’s <code>animate()</code> method to change its background color over a duration of <code>200</code>, or 2/10 of a second. The effect is a subtle color change that helps user differentiate between the “Sign In” and “Sign Up” functionality that your form provides.</p>
1122
+
<p><imgsrc="images/chapter4/android/2.gif" alt="Color animation on Android">
1123
+
<imgsrc="images/chapter4/ios/2.gif" alt="Color animation on iOS"></p>
1124
+
<blockquote>
1125
+
<p><strong>NOTE</strong>: You may notice that the text color is off with the brown background. Don’t worry about that for now; we’ll address that in chapter 6.</p>
1126
+
</blockquote>
1127
+
<p>The animation module is a lot of fun to play with, and it’s easy to use too. All you need to do is get a reference to an element using <code>getViewById()</code>, and then call that element’s <code>animate()</code> method. You may want to take a few minutes to look through our <ahref="{{site.baseurl}}/ui/animation#examples">animation samples</a> and try a few of these animations for yourself in Groceries.</p>
1128
+
<p>For now, let’s move on to another commonly used NativeScript UI element: the <code><ListView></code>.</p>
Copy file name to clipboardExpand all lines: src/chapters/chapter0.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Welcome to the NativeScript & Angular 2 getting started guide 📚. In this hand
21
21
<p>The result is a software architecture that allows you to build mobile apps using the same framework—and in some cases the same code—that you use to build Angular 2 web apps, with the performance you’d expect from native code. Let’s look at how it all works by building an app.</p>
22
22
</div>
23
23
24
-
> **TIP**: Using Angular 2 with NativeScript is optional. If you’re looking for a guide on how to use NativeScript without Angular 2, head over to our other [Getting Started Guide](http://docs.nativescript.org/start/getting-started).
24
+
> **TIP**: Using Angular 2 with NativeScript is optional. If you’re looking for a tutorial on how to use NativeScript without Angular 2, head over to our other [Getting Started Guide](http://docs.nativescript.org/start/getting-started).
Next, open`app/pages/login/login.component.ts`andaddthefollowinglineatthetop, whichimportsthe [`Color`class](http://docs.nativescript.org/ApiReference/color/Color.html) from the NativeScript color module:
AllNativeScriptUIelementsinheritfromabase [`View`class](http://docs.nativescript.org/ApiReference/ui/core/view/View.html), which contains a number of useful methods—including the `getViewById()` and `animate()` methods used in the previous example. The `getViewById()` method, as its name implies, allows you to get a reference to a child view by its `id` attribute.
129
+
130
+
OneyouhaveareferencetoaUIelement, youcancallanyofthemethodsthatelementinheritsfrom`View`. Inthiscase, youcallthe`<StackLayout id="container">`element’s`animate()`methodtochangeitsbackgroundcoloroveradurationof`200`, or 2/10 ofa second. Theeffectisasubtlecolorchangethathelpsuserdifferentiatebetweenthe “SignIn” and “SignUp” functionalitythatyourform provides.
0 commit comments