EXCEPTION: EXCEPTION: Error during instantiation of UsersList!.
ORIGINAL EXCEPTION: TypeError: Cannot read property 'run' of undefined
ORIGINAL STACKTRACE:
TypeError: Cannot read property 'run' of undefined
at SafeSubscriber._next (http://192.168.0.77:8000/dist/bundle.js:53552:23)
at SafeSubscriber.__tryOrUnsub (http://192.168.0.77:8000/dist/bundle.js:50270:16)
at SafeSubscriber.next (http://192.168.0.77:8000/dist/bundle.js:50219:22)
at Subscriber._next (http://192.168.0.77:8000/dist/bundle.js:50169:26)
at Subscriber.next (http://192.168.0.77:8000/dist/bundle.js:50133:18)
at UsersService.fetchUsers (http://192.168.0.77:8000/dist/bundle.js:53653:29)
at new UsersList (http://192.168.0.77:8000/dist/bundle.js:53556:22)
at http://192.168.0.77:8000/dist/bundle.js:25535:51
at Injector._instantiate (http://192.168.0.77:8000/dist/bundle.js:19318:27)
at Injector._instantiateProvider (http://192.168.0.77:8000/dist/bundle.js:19256:25)
ERROR CONTEXT:
[object Object] in [IsUser() in UsersApp@47:39]
node_modules\angular2\src\platform\browser\diffing_plugin_wrapper-output_path-jakXnMmL.tmp\angular2…:73 EXCEPTION: EXCEPTION: Error during instantiation of UsersList!.
ORIGINAL EXCEPTION: TypeError: Cannot read property 'run' of undefined
ORIGINAL STACKTRACE:
TypeError: Cannot read property 'run' of undefined
at SafeSubscriber._next (http://192.168.0.77:8000/dist/bundle.js:53552:23)
at SafeSubscriber.__tryOrUnsub (http://192.168.0.77:8000/dist/bundle.js:50270:16)
at SafeSubscriber.next (http://192.168.0.77:8000/dist/bundle.js:50219:22)
at Subscriber._next (http://192.168.0.77:8000/dist/bundle.js:50169:26)
at Subscriber.next (http://192.168.0.77:8000/dist/bundle.js:50133:18)
at UsersService.fetchUsers (http://192.168.0.77:8000/dist/bundle.js:53653:29)
at new UsersList (http://192.168.0.77:8000/dist/bundle.js:53556:22)
at http://192.168.0.77:8000/dist/bundle.js:25535:51
at Injector._instantiate (http://192.168.0.77:8000/dist/bundle.js:19318:27)
at Injector._instantiateProvider (http://192.168.0.77:8000/dist/bundle.js:19256:25)
ERROR CONTEXT:
[object Object] in [IsUser() in UsersApp@47:39]
import {Component, Inject, NgZone} from 'angular2/core';
import {UsersService} from '../services/UsersService';
@Component({
selector: 'users-list',
template: `
<div class="list-group">
<a href="#" class="list-group-item" *ngFor="#user of currentUsers">
<div class="media" >
<a class="pull-left" href="#">
<img class="media-object img-circle" src="{{ user.photo_50}}" alt="Аватар пользователя">
</a>
<div class="media-body">
<h4 class="media-heading">{{ user.first_name }} {{ user.last_name }}</h4>
<span class="univercity">{{user.university_name}}</span>
</div>
</div>
</a>
</div>
`
})
export class UsersList {
public currentUsers = [];
constructor(@Inject(UsersService) private UsersService, private zone:NgZone) {
UsersService.users.subscribe(newUsers => {
console.log(this.zone);
this.zone.run(()=> {
this.currentUsers = newUsers;
});
});
UsersService.fetchUsers();
}
}