Pergunta de entrevista da empresa Cognizant

Q. How can you create a component manually i.e. without using angular CLI.?

Respostas da entrevista

Sigiloso

18 de jun. de 2021

You have to create the files manually and import the component in the app module. Eg: you want to create Cart component. 1. create a folder cart 2. inside this folder create three files - cart.component.html , cart.component.css, cart.component.ts 3. In cart.component.ts - add the below lines import { Component } from '@angular/core'; @Component({ selector: 'app-cart', templateUrl: './cart.component.html', styleUrls: './cart.component.css' }) export class CartComponent { constructor(){} } 4. In app.module.ts file add import- import { CartComponent } from './Cart/cart.component'; add declaration - CartComponent

1

Sigiloso

21 de fev. de 2020

Q. How can you create a component skipping the spec.ts file?