Eugene
Eugene

Reputation: 1730

Angular, @Injectable

I have a service like this

@Injectable({providedIn: 'root'})
export default class UserService {
   ...
}

and use it inside component

@Component({
  selector: 'app-account',
  templateUrl: './account.component.html',
  styleUrls: ['./account.component.css']
})
export class AccountComponent implements OnInit {
  constructor(private userService: UserService) { }
  ...
}

Each time, when I change something in the code and it re-built, I see an error

main.ts:12 ReferenceError: UserService is not defined

What I miss? Is it incorrect implementation?

I am using Angular 11.2. My dev env inside docker.

Upvotes: 0

Views: 83

Answers (1)

brk
brk

Reputation: 50291

Remove default from export default class UserService

Upvotes: 2

Related Questions