Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexandervantrijffel/b955c3ba8b32843677c1048f15aadf6c to your computer and use it in GitHub Desktop.
Save alexandervantrijffel/b955c3ba8b32843677c1048f15aadf6c to your computer and use it in GitHub Desktop.

plugins for vs code angular2 are available there is a bootstrap() function for bootstrapping the application (replacement for ngApp)

angular cookbook tests http://pepa.holla.cz/wp-content/uploads/2015/10/AngularJS-Testing-Cookbook.pdf

https://www.ng-conf.org/#/

angular cli http://cli.angular.io

npm install -g angular-cli ng new mydreamapp ng serve

http://jpapa.me/ng2styleguide npm install --save-dev codelyzer

// story.components.ts

// modules import { Component, OnInit } from ' @angular/core'; import { Http, Response } from '@angular/http' ; import { SessionService } from './shared/session.service';

// components @Component({ slector: ' my-store', templateUrl: ' app/story.component.html', providers: [SessionService] })

export class StoryComponent implements OnInit { name = 'Han Solo';

constructor(private sessionService: SessionService) { }
ngOnInit() {
	this.sessionService.getSessions()
		.subscribe(s => this.sessions = s);
}

}

// story.component.html

Title: {{name}}
  • {{session.name}}
  • {{selectedSession.details}}
    [style.visibility]="isVisible()"
    // works for any HTML attribute!:
    <img [src]="vehicle.imageUrl">
    
    <div [class.isStopped]="isStopped">Stopped</div>
    
    // event binding
    // work for any DOM event!
    <button (click)="save()">Save</button>
    
    // two way binding
    // football in a box / banana in a box
    <input [(ngModel)]="vehicle.name">
    

    // vehicle.service.ts @Injectable() export class VehicleService { getVehicles() { return [ new Vehicle(10 'X-Wing Fighter') ]; } }

    Modules (ES6 Modules voor dependency management / requirejs vervanging) Components Templates Structural directives Data binding Services - class Dependency injection

    vs code is geschreven in electron: http://electron.atom.io angular2 digest is veel sneller angular2 is nu 45kb use kebab-case for html elements

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment