Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between angular2/core and @angular/core

Might be very stupid but I have seen several uses of

import {Component} from 'angular2/core'

and

import {Component} from '@angular/core'

but I am not able to understand when to use one or another.

Thanks

like image 889
me_digvijay Avatar asked May 29 '16 12:05

me_digvijay


People also ask

What is the Angular core?

@angular/core/global. Exposes a set of functions in the global namespace which are useful for debugging the current state of your application. These functions are exposed via the global ng "namespace" variable automatically when you import from @angular/core and run your application in development mode.

What is the difference between a shared module and a core module an Angular application would commonly use?

CoreModule should have only services and be imported only once in the AppModule . SharedModule should have anything but services and be imported in all modules that need the shared stuff (which could also be the AppModule ).

What is ɵngcc0?

It's just the name of the import. It doesn't have a special meaning. – VLAZ. Jul 29, 2021 at 8:41.

Can not found Angular core?

To solve the error "Cannot find module '@angular/core'", make sure you have installed all dependencies by running the npm install command, set the baseUrl option to src in your tsconfig. json file and restart your IDE and development server.


1 Answers

Since the first release candidate the packages are repackaging into individual packages. There is now one package for each feature area.

angular2/core (before rc.0) -> @angular/core (>= rc.0) 
like image 63
muetzerich Avatar answered Oct 05 '22 10:10

muetzerich