SlideShare a Scribd company logo
Angular 2 in Meteor
PEGGY
2015-09-11
Install Angular 2
 Angular 2 Package
 meteor add shmck:angular2
 TypeScript
 meteor add netanelgilad:angular2-typescript
System.js
 System.js is a module loader built into the shmck:angular2 package. We'll
use it to load our root component.
 Import bootstrap component with System.js
<body>
<p>Nothing here</p>
<script>System.import("client/app");</script>
</body>
Root Component - client/index.html
 A component is a controller with an attached view. Think of it like a brick in
the castle of your app.
 We'll create a root component tag called app. Let's include that
component into our main index.html file:
<body>
<app></app>
<script>System.import("client/app");</script>
</body>
client/app.ts
 First we're importing the dependencies we needed from
angular2/angular2. This is not a folder and file in your directory, but
referring to an alias provided to System.js in the shmck:angular2 package.
 Notice the @ syntax. In Angular 2, these are called Annotations.
import {Component, View, bootstrap} from 'angular2/angular2';
@Component({ selector: 'app' })
@View({ template: "<p>Hello World!</p>" })
class Socially {}
bootstrap(Socially);
templateUrl
 client/app.ts
 client/index.ng.html
import {Component, View, bootstrap} from 'angular2/angular2';
@Component({ selector: 'app' })
@View({ templateUrl: "client/index.ng.html" })
class Socially {}
bootstrap(Socially);
<p>Nothing here {{ 'yet' + '!' }}</p>
View
 The syntax is very easy:
 {{ expression | pipe }} - Angular 2 interpolation,
 #variable – local variables available in the scope of the component. The
variable can be later referred in the component’s template,
 (event) - binding to events of element or directive,
 [property] - binding to properties of element.
 *property - the star means that it is a template
 Ref. http://blog.codeleak.pl/2015/06/angular2hello-world.html
Data in the View
 The *ng-for="party of parties" attribute in the li tag is an Angular repeater
directive.
<div>
<ul>
<li *ng-for="#party of parties"> {{party.name}}
<p>{{party.description}}</p>
</li>
</ul>
</div>
Model and Controller
import {Component, View, NgFor, bootstrap} from 'angular2/angular2';
@Component({ selector: 'app' })
@View({
templateUrl: "client/index.ng.html",
directives: [NgFor] })
class Socially {
constructor () {
this.parties = [
{'name': 'Dubstep-Free Zone', 'description': 'Can we please just for an evening not listen to dubstep.'},
{'name': 'All dubstep all the time', 'description': 'Get it on!'},
{'name': 'Savage lounging', 'description': 'Leisure suit required. And only fiercest manners.'} ];
}
}
bootstrap(Socially);
Use Collection
 Use Meteor Tracker, a reactive wrapper that we will run data when a
change occurs.
 The fat arrow syntax => is also from ES2015, and tells the function to run in
it's parents context.
 model/parties.ts
 client/app.ts
Parties = new Mongo.Collection("parties");
constructor() { this.parties = Parties.find().fetch(); }
Meteor Tracker
 A reactive wrapper that we will run data when a change occurs.
 We will bind it to Angular's change detection system, Zone.js.
class Socially {
constructor () {
Tracker.autorun(zone.bind(() => {
this.parties = Parties.find().fetch();
}));
}
}
Model Driven Forms
 We are binding this.partiesForm here to a Control Group. Think of a control
group as a wrapper for a group of form controls.
export class PartiesForm {
constructor() {
this.partiesForm = new ControlGroup({
name: new Control(''),
description: new Control('')
});
}
<form [ng-form-model]="partiesForm">
<label>Name</label>
<input type="text" ng-control="name">
<label>Description</label>
<input type="text" ng-control="description">
<button>Add</button>
</form>
Two-way Bindings
 Property bindings are used to pass data from the parent to the child, and
event bindings are used to pass data from the child to the parent. So we
can use the two to implement two-way bindings.
 And since this is such a common pattern, Angular provides syntax sugar to
remove the boilerplate.
 Ref. http://victorsavkin.com/post/119943127151/angular-2-template-syntax
<input [ng-model]="todo.text" (ng-model)="todo.text=$event"></input>
<input [(ng-model)]="todo.text"></input>
Router
Router
 Install
 meteor add shmck:angular2-router
import {Component, View, bootstrap} from 'angular2/angular2';
import {routerInjectables, routerDirectives, Router, RouteConfig} from 'angular2/router';
@Component({ selector: 'app' })
@View({
template: '<router-outlet></router-outlet>‘,
Directives: [routerDirectives]
})
@RouteConfig()
class Socially {}
bootstrap(Socially, [routerInjectables]);
Router - 2
 imports from 'angular2/router'
 @RouteConfig() which will specify our routes
 View directives adding routerDirectives, allowing us to communicate with
the view
 inject routerInjectables into the child components
 a location where components will be created, the <router-outlet></router-
outlet>
 declare the base route in index.html (required when using the
HTML5LocationStrategy, rather than the HashLocationStategy)
Configuring Routes - client/app.ts
 as: alias
import {PartiesList} from 'client/parties-list/parties-list';
import {PartyDetails} from 'client/party-details/party-details';
@Component( ... )
@View( ... )
@RouteConfig([
{path: '/', component: PartiesList},
{path: '/party/:partyId', as: 'party-details', component: PartyDetails}
])
Problem
 Event Bubbling
 Clicking elements inside that div won’t trigger the event handler.
 We have to be explicit by adding ^ symbol to our binding
 Ref. http://blog.thoughtram.io/angular/2015/08/11/angular-2-template-syntax-
demystified-part-1.html
<div (click)="statement()">
<div></div>
</div>
<div (^click)="statement()">
<div></div>
</div>
<div (click)="statement()"> </div>
Problem
 Zone.js
 Zone.bind()
Meteor.call("test", function(e, n){
this.result = n;
}) ;
Meteor.call("test", (e, n)=>{
this.result = n;
}) ;
Meteor.call("test", zone.bind((e, n)=>{
this.result = n;
})) ;

More Related Content

What's hot

Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
Commit University
 
Get rid of controllers in angular 1.5.x start using component directives
Get rid of controllers in angular 1.5.x start using component directivesGet rid of controllers in angular 1.5.x start using component directives
Get rid of controllers in angular 1.5.x start using component directives
Marios Fakiolas
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
Commit University
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
Nir Kaufman
 
Angular2
Angular2Angular2
Understand components in Angular 2
Understand components in Angular 2Understand components in Angular 2
Understand components in Angular 2
codeandyou forums
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascript
Ran Wahle
 
Solid angular
Solid angularSolid angular
Solid angular
Nir Kaufman
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
Phan Tuan
 
Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2
Christoffer Noring
 
Technozaure - Angular2
Technozaure - Angular2Technozaure - Angular2
Technozaure - Angular2
Demey Emmanuel
 
ChtiJUG - Introduction à Angular2
ChtiJUG - Introduction à Angular2ChtiJUG - Introduction à Angular2
ChtiJUG - Introduction à Angular2
Demey Emmanuel
 
Modern Web Developement
Modern Web DevelopementModern Web Developement
Modern Web Developement
peychevi
 
ngNewRouter
ngNewRouterngNewRouter
ngNewRouter
phidong
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
Christoffer Noring
 
Angular 2.0 - What to expect
Angular 2.0 - What to expectAngular 2.0 - What to expect
Angular 2.0 - What to expect
Allan Marques Baptista
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with React
peychevi
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
Angular from Scratch
Angular from ScratchAngular from Scratch
Angular from Scratch
Christian Lilley
 

What's hot (20)

Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
 
Get rid of controllers in angular 1.5.x start using component directives
Get rid of controllers in angular 1.5.x start using component directivesGet rid of controllers in angular 1.5.x start using component directives
Get rid of controllers in angular 1.5.x start using component directives
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
 
Angular2
Angular2Angular2
Angular2
 
Understand components in Angular 2
Understand components in Angular 2Understand components in Angular 2
Understand components in Angular 2
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascript
 
Solid angular
Solid angularSolid angular
Solid angular
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2
 
Technozaure - Angular2
Technozaure - Angular2Technozaure - Angular2
Technozaure - Angular2
 
ChtiJUG - Introduction à Angular2
ChtiJUG - Introduction à Angular2ChtiJUG - Introduction à Angular2
ChtiJUG - Introduction à Angular2
 
Modern Web Developement
Modern Web DevelopementModern Web Developement
Modern Web Developement
 
ngNewRouter
ngNewRouterngNewRouter
ngNewRouter
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
Angular 2.0 - What to expect
Angular 2.0 - What to expectAngular 2.0 - What to expect
Angular 2.0 - What to expect
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with React
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
 
Angular from Scratch
Angular from ScratchAngular from Scratch
Angular from Scratch
 

Similar to Peggy angular 2 in meteor

Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2
Paras Mendiratta
 
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Frost
 
Angular2RoutingSetupByShubham
Angular2RoutingSetupByShubhamAngular2RoutingSetupByShubham
Angular2RoutingSetupByShubham
Shubham Verma
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Ontico
 
Angular Notes.pdf
Angular Notes.pdfAngular Notes.pdf
Angular Notes.pdf
sagarpal60
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
William Marques
 
Migrating to Angular 2
Migrating to Angular 2Migrating to Angular 2
Migrating to Angular 2
FITC
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
Katy Slemon
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
Ahmed Moawad
 
Angular 2 in-1
Angular 2 in-1 Angular 2 in-1
Angular 2 in-1
GlobalLogic Ukraine
 
Angular 2 - a New Hope
Angular 2 - a New HopeAngular 2 - a New Hope
Angular 2 - a New Hope
Sami Suo-Heikki
 
はじめてのAngular2
はじめてのAngular2はじめてのAngular2
はじめてのAngular2
Kenichi Kanai
 
Routing to components
Routing to componentsRouting to components
Routing to components
Christopher Caplinger
 
mean stack
mean stackmean stack
mean stack
michaelaaron25322
 
هیبرید کارا، از رویا تا واقعیت!
هیبرید کارا، از رویا تا واقعیت!هیبرید کارا، از رویا تا واقعیت!
هیبرید کارا، از رویا تا واقعیت!
Web Standards School
 
angular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdfangular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdf
NuttavutThongjor1
 
anugula2setupbyshubham
anugula2setupbyshubhamanugula2setupbyshubham
anugula2setupbyshubham
Shubham Verma
 
Evan Schultz - Angular Camp - ng2-redux
Evan Schultz - Angular Camp - ng2-reduxEvan Schultz - Angular Camp - ng2-redux
Evan Schultz - Angular Camp - ng2-redux
Evan Schultz
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
Jeado Ko
 
Angular routing
Angular routingAngular routing
Angular routing
Sultan Ahmed
 

Similar to Peggy angular 2 in meteor (20)

Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2
 
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
 
Angular2RoutingSetupByShubham
Angular2RoutingSetupByShubhamAngular2RoutingSetupByShubham
Angular2RoutingSetupByShubham
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
 
Angular Notes.pdf
Angular Notes.pdfAngular Notes.pdf
Angular Notes.pdf
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
 
Migrating to Angular 2
Migrating to Angular 2Migrating to Angular 2
Migrating to Angular 2
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Angular 2 in-1
Angular 2 in-1 Angular 2 in-1
Angular 2 in-1
 
Angular 2 - a New Hope
Angular 2 - a New HopeAngular 2 - a New Hope
Angular 2 - a New Hope
 
はじめてのAngular2
はじめてのAngular2はじめてのAngular2
はじめてのAngular2
 
Routing to components
Routing to componentsRouting to components
Routing to components
 
mean stack
mean stackmean stack
mean stack
 
هیبرید کارا، از رویا تا واقعیت!
هیبرید کارا، از رویا تا واقعیت!هیبرید کارا، از رویا تا واقعیت!
هیبرید کارا، از رویا تا واقعیت!
 
angular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdfangular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdf
 
anugula2setupbyshubham
anugula2setupbyshubhamanugula2setupbyshubham
anugula2setupbyshubham
 
Evan Schultz - Angular Camp - ng2-redux
Evan Schultz - Angular Camp - ng2-reduxEvan Schultz - Angular Camp - ng2-redux
Evan Schultz - Angular Camp - ng2-redux
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
 
Angular routing
Angular routingAngular routing
Angular routing
 

More from LearningTech

vim
vimvim
PostCss
PostCssPostCss
PostCss
LearningTech
 
ReactJs
ReactJsReactJs
ReactJs
LearningTech
 
Docker
DockerDocker
Docker
LearningTech
 
Semantic ui
Semantic uiSemantic ui
Semantic ui
LearningTech
 
node.js errors
node.js errorsnode.js errors
node.js errors
LearningTech
 
Process control nodejs
Process control nodejsProcess control nodejs
Process control nodejs
LearningTech
 
Expression tree
Expression treeExpression tree
Expression tree
LearningTech
 
SQL 效能調校
SQL 效能調校SQL 效能調校
SQL 效能調校
LearningTech
 
flexbox report
flexbox reportflexbox report
flexbox report
LearningTech
 
Vic weekly learning_20160504
Vic weekly learning_20160504Vic weekly learning_20160504
Vic weekly learning_20160504
LearningTech
 
Reflection &amp; activator
Reflection &amp; activatorReflection &amp; activator
Reflection &amp; activator
LearningTech
 
Peggy markdown
Peggy markdownPeggy markdown
Peggy markdown
LearningTech
 
Node child process
Node child processNode child process
Node child process
LearningTech
 
20160415ken.lee
20160415ken.lee20160415ken.lee
20160415ken.lee
LearningTech
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
LearningTech
 
Expression tree
Expression treeExpression tree
Expression tree
LearningTech
 
Vic weekly learning_20160325
Vic weekly learning_20160325Vic weekly learning_20160325
Vic weekly learning_20160325
LearningTech
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tips
LearningTech
 
git command
git commandgit command
git command
LearningTech
 

More from LearningTech (20)

vim
vimvim
vim
 
PostCss
PostCssPostCss
PostCss
 
ReactJs
ReactJsReactJs
ReactJs
 
Docker
DockerDocker
Docker
 
Semantic ui
Semantic uiSemantic ui
Semantic ui
 
node.js errors
node.js errorsnode.js errors
node.js errors
 
Process control nodejs
Process control nodejsProcess control nodejs
Process control nodejs
 
Expression tree
Expression treeExpression tree
Expression tree
 
SQL 效能調校
SQL 效能調校SQL 效能調校
SQL 效能調校
 
flexbox report
flexbox reportflexbox report
flexbox report
 
Vic weekly learning_20160504
Vic weekly learning_20160504Vic weekly learning_20160504
Vic weekly learning_20160504
 
Reflection &amp; activator
Reflection &amp; activatorReflection &amp; activator
Reflection &amp; activator
 
Peggy markdown
Peggy markdownPeggy markdown
Peggy markdown
 
Node child process
Node child processNode child process
Node child process
 
20160415ken.lee
20160415ken.lee20160415ken.lee
20160415ken.lee
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 
Expression tree
Expression treeExpression tree
Expression tree
 
Vic weekly learning_20160325
Vic weekly learning_20160325Vic weekly learning_20160325
Vic weekly learning_20160325
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tips
 
git command
git commandgit command
git command
 

Recently uploaded

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 

Recently uploaded (20)

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 

Peggy angular 2 in meteor

  • 1. Angular 2 in Meteor PEGGY 2015-09-11
  • 2. Install Angular 2  Angular 2 Package  meteor add shmck:angular2  TypeScript  meteor add netanelgilad:angular2-typescript
  • 3. System.js  System.js is a module loader built into the shmck:angular2 package. We'll use it to load our root component.  Import bootstrap component with System.js <body> <p>Nothing here</p> <script>System.import("client/app");</script> </body>
  • 4. Root Component - client/index.html  A component is a controller with an attached view. Think of it like a brick in the castle of your app.  We'll create a root component tag called app. Let's include that component into our main index.html file: <body> <app></app> <script>System.import("client/app");</script> </body>
  • 5. client/app.ts  First we're importing the dependencies we needed from angular2/angular2. This is not a folder and file in your directory, but referring to an alias provided to System.js in the shmck:angular2 package.  Notice the @ syntax. In Angular 2, these are called Annotations. import {Component, View, bootstrap} from 'angular2/angular2'; @Component({ selector: 'app' }) @View({ template: "<p>Hello World!</p>" }) class Socially {} bootstrap(Socially);
  • 6. templateUrl  client/app.ts  client/index.ng.html import {Component, View, bootstrap} from 'angular2/angular2'; @Component({ selector: 'app' }) @View({ templateUrl: "client/index.ng.html" }) class Socially {} bootstrap(Socially); <p>Nothing here {{ 'yet' + '!' }}</p>
  • 7.
  • 8. View  The syntax is very easy:  {{ expression | pipe }} - Angular 2 interpolation,  #variable – local variables available in the scope of the component. The variable can be later referred in the component’s template,  (event) - binding to events of element or directive,  [property] - binding to properties of element.  *property - the star means that it is a template  Ref. http://blog.codeleak.pl/2015/06/angular2hello-world.html
  • 9. Data in the View  The *ng-for="party of parties" attribute in the li tag is an Angular repeater directive. <div> <ul> <li *ng-for="#party of parties"> {{party.name}} <p>{{party.description}}</p> </li> </ul> </div>
  • 10. Model and Controller import {Component, View, NgFor, bootstrap} from 'angular2/angular2'; @Component({ selector: 'app' }) @View({ templateUrl: "client/index.ng.html", directives: [NgFor] }) class Socially { constructor () { this.parties = [ {'name': 'Dubstep-Free Zone', 'description': 'Can we please just for an evening not listen to dubstep.'}, {'name': 'All dubstep all the time', 'description': 'Get it on!'}, {'name': 'Savage lounging', 'description': 'Leisure suit required. And only fiercest manners.'} ]; } } bootstrap(Socially);
  • 11. Use Collection  Use Meteor Tracker, a reactive wrapper that we will run data when a change occurs.  The fat arrow syntax => is also from ES2015, and tells the function to run in it's parents context.  model/parties.ts  client/app.ts Parties = new Mongo.Collection("parties"); constructor() { this.parties = Parties.find().fetch(); }
  • 12. Meteor Tracker  A reactive wrapper that we will run data when a change occurs.  We will bind it to Angular's change detection system, Zone.js. class Socially { constructor () { Tracker.autorun(zone.bind(() => { this.parties = Parties.find().fetch(); })); } }
  • 13. Model Driven Forms  We are binding this.partiesForm here to a Control Group. Think of a control group as a wrapper for a group of form controls. export class PartiesForm { constructor() { this.partiesForm = new ControlGroup({ name: new Control(''), description: new Control('') }); } <form [ng-form-model]="partiesForm"> <label>Name</label> <input type="text" ng-control="name"> <label>Description</label> <input type="text" ng-control="description"> <button>Add</button> </form>
  • 14. Two-way Bindings  Property bindings are used to pass data from the parent to the child, and event bindings are used to pass data from the child to the parent. So we can use the two to implement two-way bindings.  And since this is such a common pattern, Angular provides syntax sugar to remove the boilerplate.  Ref. http://victorsavkin.com/post/119943127151/angular-2-template-syntax <input [ng-model]="todo.text" (ng-model)="todo.text=$event"></input> <input [(ng-model)]="todo.text"></input>
  • 16. Router  Install  meteor add shmck:angular2-router import {Component, View, bootstrap} from 'angular2/angular2'; import {routerInjectables, routerDirectives, Router, RouteConfig} from 'angular2/router'; @Component({ selector: 'app' }) @View({ template: '<router-outlet></router-outlet>‘, Directives: [routerDirectives] }) @RouteConfig() class Socially {} bootstrap(Socially, [routerInjectables]);
  • 17. Router - 2  imports from 'angular2/router'  @RouteConfig() which will specify our routes  View directives adding routerDirectives, allowing us to communicate with the view  inject routerInjectables into the child components  a location where components will be created, the <router-outlet></router- outlet>  declare the base route in index.html (required when using the HTML5LocationStrategy, rather than the HashLocationStategy)
  • 18. Configuring Routes - client/app.ts  as: alias import {PartiesList} from 'client/parties-list/parties-list'; import {PartyDetails} from 'client/party-details/party-details'; @Component( ... ) @View( ... ) @RouteConfig([ {path: '/', component: PartiesList}, {path: '/party/:partyId', as: 'party-details', component: PartyDetails} ])
  • 19.
  • 20. Problem  Event Bubbling  Clicking elements inside that div won’t trigger the event handler.  We have to be explicit by adding ^ symbol to our binding  Ref. http://blog.thoughtram.io/angular/2015/08/11/angular-2-template-syntax- demystified-part-1.html <div (click)="statement()"> <div></div> </div> <div (^click)="statement()"> <div></div> </div> <div (click)="statement()"> </div>
  • 21. Problem  Zone.js  Zone.bind() Meteor.call("test", function(e, n){ this.result = n; }) ; Meteor.call("test", (e, n)=>{ this.result = n; }) ; Meteor.call("test", zone.bind((e, n)=>{ this.result = n; })) ;