typescript - Detect When HTML Video Ends in Angular 2 -


i'm trying detect when html video ends in ionic2 (angular2 , typescript). code snippets below:

template:

<video poster="" id="v" playsinline autoplay webkit-playsinline onended="vidended()">     <source src="assets/vid.mp4" type="video/mp4"> </video> 

component:

vidended() {     console.log("video ended");     this.leavepage(); } 

what doing wrong? in advance.

in angular 2, need add - between prefix on , event name, or remove prefix on , surround event name () bind event. so, correct syntax in case 1 of these two, can use whichever prefer because both same thing:

  • on-ended="vidended()"
  • (ended)="viaended()"

check out angular 2 binding syntax.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -