Discussion for angular (2+) - need help? create a stackblitz with your issue to get help faster using this template: https://stackblitz.com/fork/angular-issue-repro2
import {Component} from 'angular2/core'
@Component({
selector: 'gridifier',
template: `
<div class="gridifier">
<ng-content></ng-content>
</div>
`
})
export class Gridifier {
ngOnInit() {
var grid = new (<any>window).Gridifier($('.gridifier'), {
query: '> div',
dragifier: true
})
grid.append(grid.collectNew())
}
}
How should I rewrite the above component to get rid of $('.gridifier')
? Not sure what the best practice is when wrapping a jQuery plugin like that.
@Component({
selector: 'gridifier',
template: `
<div class="gridifier" #gridifier>
<ng-content></ng-content>
</div>
`
})
export class Gridifier {
@ViewChild('gridifier') gridifier;
ngOnInit() {
var grid = new (<any>window).Gridifier(this.gridifier.nativeElement, {
query: '> div',
dragifier: true
})
grid.append(grid.collectNew())
}
}
Cannot read property 'nativeElement' of null
. Tried inside ngAfterViewInit
as well but same result
ngAfterViewInit
http://plnkr.co/edit/Pm268dYmQ6lu9BvPH6kr?p=preview
Hi guys! I'm just having kind of a mental problem understanding the basics of Observables... So my question basically boils down to one thing: So in this Rx.js world we have an Observable that represents the datasource. Now I can subscribe an Observer to that Observable - so in my understanding the Observer is the function that I pass to the "subscribe"-method... is that correct? If so, I just dont get this syntax:
Observable.create((observer) => {
observer.next(5);
observer.next(10);
})
Why is the "thing" that emits the new values the observer?! can anyone put that in simple words for an rxjs newbie? :grimacing:
ngAfterContentInit
?
ngAfterContentChecked
is called every time change detection runs...
ngAfterContentChecked
is being triggered excessively when a mouse listener is active. hmm.