I am new to Angular2 and my trying my hand using @Input but I am not able to proceed because of the below issue. After the @Input the component does not proceed further. I have verified in chrome developer tools and I see that execution goes outside the class immediately after the @Input
import {Component, Input, OnInit} from 'angular2/core';
import {Http, HTTP_PROVIDERS} from 'angular2/http';
import 'rxjs/Rx';
var availableJobs = [];
@Component({
selector: 'job-categories',
templateUrl:'templates/job.categories.html',
providers:[HTTP_PROVIDERS]
})
export class JobCategories{
@Input('rows') rows: string;
@Input('cols') columns: string;
constructor(http: Http){
http.get('appjs/dummyjson.json').map(res => res.json()).subscribe(
(data) => {
availableJobs = data;
console.log(availableJobs);
});
}
}
Could someone please help me overcome.
The HTML tag is
ngOnChanges()lifecycle callback is called the first time (just beforengOnInit()is called. The constructor is executed before any lifecycle callback is called.