Created
July 5, 2016 00:55
-
-
Save takuya-andou/c75835c3959d1ed76bf21690fcb39256 to your computer and use it in GitHub Desktop.
angular2でページ読み込み後に処理を実行する方法 ref: http://qiita.com/takuya-andou/items/24f4d5dbd86e102fe231
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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