Angular 14….Standalone… Component, directive and pipe..New Roadmap
Yes ,,, In 14 version angular given option to work as standalone now no need to use module…its really new journey and game changer for angular roadmap.
So for converting existing component
you need to put standalone true.
@Component({
standalone:true,
selector: ‘app-coins’,
imports:[CommonModule],
providers:[],
templateUrl: ‘./coins.component.html’,
styleUrls: [‘./coins.component.scss’]
})
It will work without part of any module,
But along with it you need to provide dependent module or component, pipe, directive inject in imports,
and services in providers
Routing
Now in routing also have option to lazy load standalone component
{
path:’lazycomponent’,
loadComponent: ()=> import(‘./coins/coins.component’).then(mod=> mod.CoinsComponent)
}