Permalink
Browse files

update gh-pages and add ViewChild

  • Loading branch information...
1 parent 1a43b1d commit 6dcb54385fcf465a55296a3f7636e2927447d117 @mhartington mhartington committed Apr 19, 2016
Showing with 149 additions and 84 deletions.
  1. +1 −1 Gemfile
  2. +89 −82 Gemfile.lock
  3. +1 −1 _config.yml
  4. +1 −0 _includes/sidebar.html
  5. +57 −0 viewChild/index.md
View
@@ -1,2 +1,2 @@
source 'https://rubygems.org'
-gem 'github-pages'
+gem 'github-pages', group: :jekyll_plugins
View
@@ -2,125 +2,132 @@ GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
- activesupport (4.2.1)
+ activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
- blankslate (2.1.2.4)
- celluloid (0.16.0)
- timers (~> 4.0.0)
- classifier-reborn (2.0.3)
- fast-stemmer (~> 1.0)
+ addressable (2.4.0)
coffee-script (2.4.1)
coffee-script-source
execjs
- coffee-script-source (1.9.1.1)
+ coffee-script-source (1.10.0)
colorator (0.1)
- execjs (2.5.2)
- fast-stemmer (1.0.2)
- ffi (1.9.8)
+ ethon (0.8.1)
+ ffi (>= 1.3.0)
+ execjs (2.6.0)
+ faraday (0.9.2)
+ multipart-post (>= 1.2, < 3)
+ ffi (1.9.10)
gemoji (2.1.0)
- github-pages (34)
+ github-pages (71)
RedCloth (= 4.2.9)
- github-pages-health-check (~> 0.2)
- jekyll (= 2.4.0)
+ github-pages-health-check (= 1.1.0)
+ jekyll (= 3.0.3)
jekyll-coffeescript (= 1.0.1)
- jekyll-mentions (= 0.2.1)
- jekyll-redirect-from (= 0.6.2)
- jekyll-sass-converter (= 1.2.0)
- jekyll-sitemap (= 0.8.1)
- jemoji (= 0.4.0)
- kramdown (= 1.5.0)
- liquid (= 2.6.1)
- maruku (= 0.7.0)
+ jekyll-feed (= 0.5.1)
+ jekyll-gist (= 1.4.0)
+ jekyll-github-metadata (= 1.11.0)
+ jekyll-mentions (= 1.1.2)
+ jekyll-paginate (= 1.1.0)
+ jekyll-redirect-from (= 0.10.0)
+ jekyll-sass-converter (= 1.3.0)
+ jekyll-seo-tag (= 1.3.3)
+ jekyll-sitemap (= 0.10.0)
+ jekyll-textile-converter (= 0.1.0)
+ jemoji (= 0.6.2)
+ kramdown (= 1.10.0)
+ liquid (= 3.0.6)
mercenary (~> 0.3)
- pygments.rb (= 0.6.1)
- rdiscount (= 2.1.7)
- redcarpet (= 3.1.2)
+ rdiscount (= 2.1.8)
+ redcarpet (= 3.3.3)
+ rouge (= 1.10.1)
terminal-table (~> 1.4)
- github-pages-health-check (0.3.0)
- net-dns (~> 0.6)
+ github-pages-health-check (1.1.0)
+ addressable (~> 2.3)
+ net-dns (~> 0.8)
+ octokit (~> 4.0)
public_suffix (~> 1.4)
- hitimes (1.2.2)
- html-pipeline (1.9.0)
- activesupport (>= 2)
- nokogiri (~> 1.4)
+ typhoeus (~> 0.7)
+ html-pipeline (2.4.0)
+ activesupport (>= 2, < 5)
+ nokogiri (>= 1.4)
i18n (0.7.0)
- jekyll (2.4.0)
- classifier-reborn (~> 2.0)
+ jekyll (3.0.3)
colorator (~> 0.1)
- jekyll-coffeescript (~> 1.0)
- jekyll-gist (~> 1.0)
- jekyll-paginate (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
- liquid (~> 2.6.1)
+ liquid (~> 3.0)
mercenary (~> 0.3.3)
- pygments.rb (~> 0.6.0)
- redcarpet (~> 3.1)
+ rouge (~> 1.7)
safe_yaml (~> 1.0)
- toml (~> 0.1.0)
jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2)
- jekyll-gist (1.2.1)
- jekyll-mentions (0.2.1)
- html-pipeline (~> 1.9.0)
- jekyll (~> 2.0)
+ jekyll-feed (0.5.1)
+ jekyll-gist (1.4.0)
+ octokit (~> 4.2)
+ jekyll-github-metadata (1.11.0)
+ octokit (~> 4.0)
+ jekyll-mentions (1.1.2)
+ html-pipeline (~> 2.3)
+ jekyll (~> 3.0)
jekyll-paginate (1.1.0)
- jekyll-redirect-from (0.6.2)
- jekyll (~> 2.0)
- jekyll-sass-converter (1.2.0)
+ jekyll-redirect-from (0.10.0)
+ jekyll (>= 2.0)
+ jekyll-sass-converter (1.3.0)
sass (~> 3.2)
- jekyll-sitemap (0.8.1)
- jekyll-watch (1.2.1)
- listen (~> 2.7)
- jemoji (0.4.0)
+ jekyll-seo-tag (1.3.3)
+ jekyll (~> 3.0)
+ jekyll-sitemap (0.10.0)
+ jekyll-textile-converter (0.1.0)
+ RedCloth (~> 4.0)
+ jekyll-watch (1.3.1)
+ listen (~> 3.0)
+ jemoji (0.6.2)
gemoji (~> 2.0)
- html-pipeline (~> 1.9)
- jekyll (~> 2.0)
- json (1.8.2)
- kramdown (1.5.0)
- liquid (2.6.1)
- listen (2.10.0)
- celluloid (~> 0.16.0)
+ html-pipeline (~> 2.2)
+ jekyll (>= 3.0)
+ json (1.8.3)
+ kramdown (1.10.0)
+ liquid (3.0.6)
+ listen (3.0.6)
rb-fsevent (>= 0.9.3)
- rb-inotify (>= 0.9)
- maruku (0.7.0)
- mercenary (0.3.5)
- mini_portile (0.6.2)
- minitest (5.6.0)
+ rb-inotify (>= 0.9.7)
+ mercenary (0.3.6)
+ mini_portile2 (2.0.0)
+ minitest (5.8.4)
+ multipart-post (2.0.0)
net-dns (0.8.0)
- nokogiri (1.6.6.2)
- mini_portile (~> 0.6.0)
- parslet (1.5.0)
- blankslate (~> 2.0)
- posix-spawn (0.3.11)
- public_suffix (1.5.1)
- pygments.rb (0.6.1)
- posix-spawn (~> 0.3.6)
- yajl-ruby (~> 1.2.0)
- rb-fsevent (0.9.4)
- rb-inotify (0.9.5)
+ nokogiri (1.6.7.2)
+ mini_portile2 (~> 2.0.0.rc2)
+ octokit (4.3.0)
+ sawyer (~> 0.7.0, >= 0.5.3)
+ public_suffix (1.5.3)
+ rb-fsevent (0.9.7)
+ rb-inotify (0.9.7)
ffi (>= 0.5.0)
- rdiscount (2.1.7)
- redcarpet (3.1.2)
+ rdiscount (2.1.8)
+ redcarpet (3.3.3)
+ rouge (1.10.1)
safe_yaml (1.0.4)
- sass (3.4.13)
- terminal-table (1.4.5)
+ sass (3.4.22)
+ sawyer (0.7.0)
+ addressable (>= 2.3.5, < 2.5)
+ faraday (~> 0.8, < 0.10)
+ terminal-table (1.5.2)
thread_safe (0.3.5)
- timers (4.0.1)
- hitimes
- toml (0.1.2)
- parslet (~> 1.5.0)
+ typhoeus (0.8.0)
+ ethon (>= 0.8.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
- yajl-ruby (1.2.1)
PLATFORMS
ruby
DEPENDENCIES
github-pages
+
+BUNDLED WITH
+ 1.11.2
View
@@ -1,4 +1,4 @@
markdown: kramdown
kramdown:
input: GFM
- syntax_highlighter: rouge
+highlighter: rouge
@@ -11,6 +11,7 @@
<li><a href="/templates/">Templates</a></li>
<li><a href="/events/">Events</a></li>
<li><a href="/forms/">Forms</a></li>
+ <li><a href="/viewChild/">ViewChild</a></li>
<li class="group"><a href="/es6">ES6/TypeScript</a>
<ul>
View
@@ -0,0 +1,57 @@
+---
+layout: default
+title: ViewChild
+edit_link: https://github.com/driftyco/learn-angular2/edit/gh-pages/viewChild/index.md
+tweet: "Access child components in Angular 2"
+---
+
+
+_Updated April 18, 2016_
+
+Since all components in Angular 2 have classes, you might want to call methods on these classes. This requires access to the component.
+
+#### `@ViewChild`
+
+To get access to a component and it's methods, we can use the `@ViewChild` annotation.
+
+For example, our `<user-profile>` component can have a method called `sendData()`.
+
+
+```javascript
+{% raw %}
+@Component({
+ selector: 'user-profile'
+})
+
+export class UserProfile {
+ constructor() {}
+ sendData(){
+ //send data
+ }
+}
+{% endraw %}
+```
+
+When use the `user-profile` on our main page, we can reference the class and then assign it to a local property
+
+```javascript
+{% raw %}
+import {Component, ViewChild} from 'angular2/core';
+import {UserProfile} from '../user-profile';
+@Component({
+ template: '<user-profile (click)="update()"></user-profile>',
+ directives: [UserProfile]
+})
+export class MasterPage {
+ // we pass the Component we want to get
+ // assign to a public property on our class
+ // give it the type for our component
+ @ViewChild(UserProfile) userProfile: UserProfile
+ constructor() { }
+ update(){
+ this.userProfile.sendData();
+ }
+}
+{% endraw %}
+```
+

0 comments on commit 6dcb543

Please sign in to comment.