Angular – Cannot find name ‘Injectable’ – Solved

This post is focused on Cannot find name ‘Injectable’ in angular. This post will give you simple example of angular error ts2304 cannot find name ‘Injectable’. In this article, we will implement a angular cannot find Injectable error. I’m going to show you about angular cannot find name Injectable.

You can use this solution with angular 8, angular 9, angular 10, angular 11, angular 12 and angular 13 version.

In this post, I will give you the solution of “Cannot find name ‘Injectable'” in angular application. we need to import Injectable from @angular/core library. so let’s see below the solution and full code.


let’s import Injectable from @angular/core npm package, as bellow:

Import Output:

import { Injectable } from '@angular/core';

Let’s see bellow working code:


import { Component, OnInit, Inject, Injectable } from '@angular/core';

import { DOCUMENT } from '@angular/common';


selector: 'app-root',

templateUrl: './app.component.html',

styleUrls: ['./app.component.css']


export class AppComponent implements OnInit {

port = '';






constructor(@Inject(DOCUMENT) private document: any) { }






ngOnInit() {

this.port = this.document.location.port;




I hope it can help you….medrectangle-4-multi-155{border:none!important;display:block!important;float:none;line-height:0;margin-bottom:15px!important;margin-left:0!important;margin-right:0!important;margin-top:15px!important;max-width:100%!important;min-height:250px;min-width:300px;padding:0;text-align:center!important}

Leave a Comment