@jmiguelvargas wrote:
Hello, someone know which is the equivalent of "$scope.$apply" in ionic2, i know that this functionality in angular 2 is implemented like the bellow code but i tried adapt it in ionic 2 and i fail run it correctly.
import {Component, LifeCycle, NgZone} from 'angular2/angular2'
@Component({
selector: 'my-app',
template:
<div>
Hello world!!! Time: {{ time }}.
</div>
})
export class App {
time: number = 0;constructor(lc: LifeCycle, zone: NgZone) {
zone.runOutsideAngular(() => {
setInterval(() => {
this.time = Date.now();lc.tick(); // comment this line and "time" will stop updating }, 1000); })
}
doCheck() {
console.log('check', Date.now());
}
}this code I found it in this topic in http://stackoverflow.com/questions/33174146/angular-2-0-equivalent-to-scope-apply.
Thanks, i hope your answers.
Posts: 1
Participants: 1