Nick Nick - 1 year ago 135
AngularJS Question

Angular 2: is not a function but it exist

I am trying to get an array out of a different class but he says the function does not exist.
here is my code:

import {Component} from 'angular2/core'
import {CourseService} from './course.service'

selector: 'courses',
template: `
{{ title }}
<li *ngFor ="#course of courses">
providers: [CourseService]
export class CoursesComponent{
title = "The title of courses page";

constructor(courseService: CourseService){ = CourseService.getCourses();

this document is named courses.component.ts

I also got course.service.ts:

export class CourseService{
getCourses() ; string[]{
return ["Course1","Course2","Course3"];

Answer Source

You need to reference the argument name, not the argument type = courseService.getCourses();
                ^ lower case c
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download