Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AngularDart

yujikawa
January 23, 2019

 AngularDart

yujikawa

January 23, 2019
Tweet

More Decks by yujikawa

Other Decks in Programming

Transcript

  1. OHEBSUίϚϯυΛݟͯΈΔ dOHEBSUI /HEBSUJTBDPNNBOEMJOFJOUFSGBDFGPS"OHVMBS%BSU 6TBHFOHEBSUDPNNBOE<BSHVNFOUT> (MPCBMPQUJPOT I IFMQ1SJOUUIJTVTBHFJOGPSNBUJPO W <OP>WFSCPTF0VUQVUFYUSBMPHHJOHJOGPSNBUJPO "WBJMBCMFDPNNBOET

    HFOFSBUF(FOFSBUFDPNQPOFOUPSUFTU IFMQ%JTQMBZIFMQJOGPSNBUJPOGPSOHEBSU OFX$SFBUFBO"OHVMBS%BSUQSPKFDU 3VOOHEBSUIFMQDPNNBOEGPSNPSFJOGPSNBUJPOBCPVUBDPNNBOE
  2. OH.PEFMΛ࢖͏ EJSFDUJWFTϓϩύςΟʹGPSN%JSFWUJWFTΛ௥Ճ͢Δɺ͜ΕͰ ࢖͑ΔΑ͏ʹͳΔɻ import 'package:angular/angular.dart'; import 'package:angular_forms/angular_forms.dart'; import './hero.dart'; @Component(

    selector: 'app-component', templateUrl: 'app_component.html', directives: [formDirectives] ) class AppComponent { final String title = 'Tour of Hero'; Hero hero = Hero(1, 'Windstorm'); } BQQ@DPNQPOFOUEBSU IUUQTXFCEFWEBSUMBOHPSHBQJBOHVMBS@GPSNTBOHVMBS@GPSNTGPSN%JSFDUJWFTDPOTUBOU
  3. OH*G΍OH'PSΛ࢖͏ EJSFDUJWFTϓϩύςΟʹDPSF%JSFDUJWFTΛ௥Ճ͢Δɺ͜ΕͰ ࢖͑ΔΑ͏ʹͳΔɻ import 'package:angular/angular.dart'; import 'package:angular_forms/angular_forms.dart'; import './hero.dart'; @Component(

    selector: 'app-component', templateUrl: 'app_component.html', directives: [coreDirectives, formDirectives] ) class AppComponent { final String title = 'Tour of Hero'; Hero hero = Hero(1, 'Windstorm'); } BQQ@DPNQPOFOUEBSU IUUQTXFCEFWEBSUMBOHPSHBQJBOHVMBSBOHVMBSDPSF%JSFDUJWFTDPOTUBOU
  4. OH*G΍OH'PSΛ࢖͏ OH'PS΍OH*GΛςϯϓϨʔτʹ௥Ճ͠·͢ɻ͜ͷลͷॻ͖ํ ͸ຊՈ"OHVMBSͱಉͩͬͨ͡ <h1>{{title}}</h1> <h2>Heroes</h2> <ul class="heroes"> <li *ngFor="let hero

    of heroes" (click)="onSelect(hero)" [class.selected] = "hero === selected"> <span class="badge">{{hero.id}}</span> {{hero.name}} </li> </ul> <div *ngIf="selected != null"> <h2>{{selected.name}}</h2> <div><label>id: </label>{{selected.id}}</div> <div> <label>name: </label> <input [(ngModel)]="selected.name" placeholder="name"> </div> </div> BQQ@DPNQPOFOUIUNM
  5. !*OQVUΛ࢖͏ ֎͔Β஋Λड͚ΔͨΊʹ!*OQVUΛ࢖͏ɻ͜ΕʹΑΓηϨΫ τ͞ΕͨIFSPΛऔಘ import 'package:angular/angular.dart'; import 'package:angular_forms/angular_forms.dart'; import './hero.dart'; @Component(

    selector: 'hero-component', templateUrl: 'hero_component.html', directives: [coreDirectives, formDirectives], ) class HeroComponent { @Input() Hero hero; } MJCTSDIFSP@DPNQPOFOUEBSU
  6. ֎ग़͠ςϯϓϨʔτΛ࢖͏ ઌ΄Ͳ֎ʹग़ͨ͠IFSP@DPNQPOFOUIUNMΛBQQ@DPNQPOFOUIUNMͰ ࢖͏ɻBQQ@DPNQPOFOUEBSUͷEJSFDUJWFTʹ௥Ճ͢Δ͜ͱΛ๨Εͣʹ // লུ <hero-component [hero]="selected"></hero- component> BQQ@DPNQPOFOUIUNM import

    './src/hero_component.dart'; @Component( selector: 'app-component', templateUrl: 'app_component.html', directives: [coreDirectives, HeroComponent], styleUrls: ['app_component.css'], ) // লུ BQQ@DPNQPOFOUEBSU