Skip to content

Instantly share code, notes, and snippets.

@takuya-andou
Created July 5, 2016 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takuya-andou/c75835c3959d1ed76bf21690fcb39256 to your computer and use it in GitHub Desktop.
Save takuya-andou/c75835c3959d1ed76bf21690fcb39256 to your computer and use it in GitHub Desktop.
angular2でページ読み込み後に処理を実行する方法 ref: http://qiita.com/takuya-andou/items/24f4d5dbd86e102fe231
import {Component, AfterViewInit} from 'angular2/core';
@Component({
selector: 'home',
templateUrl: './components/home/home.html'
})
export class HomeCmp implements AfterViewInit {
ngAfterViewInit() {
//Copy in all the js code from the script.js. Typescript will complain but it works just fine
}
ngAfterViewInit() {
var mVideo = <HTMLVideoElement> document.getElementById('video');
mVideo.addEventListener("ended", function(){
console.log("動画が終了しました"); //ここに要素入れ替えのスクリプトを書く
}, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment