I've got a brand new app create with a ng-cli with this very simple code ^^
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(private my: string) {}
}
and I've got in the console
EXCEPTION: No provider for String!
I don't see any error in the code so what's wrong !
In ng-book I can read
export class Article {
title: string;
link: string;
votes: number;
constructor(title: string, link: string, votes?: number) {
this.title = title;
this.link = link;
this.votes = votes || 0;
}
}
Take a look at
https://github.com/Microsoft/TypeScriptSamples/blob/master/greeter/greeter.ts
myto be? Where should the value come from?