S
S
sunny_puppy2017-11-16 01:02:38
JavaScript
sunny_puppy, 2017-11-16 01:02:38

What does @ mean before Component in an Angular Typescript file?

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

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Mirka, 2017-11-16
@sunny_puppy

This is a decorator that acts as an annotation that tells some information about the class described below. Referring to the answer above, here the decorator says that the class below is a component that has a selector greet, which will then be searched in the html template and substitute the results of the work of this component, its template and styles there. template contains html template. If you replace it with templateURL, then you can specify a link to the template in it, which will be substituted in the place where the selector will be called greet-<greet></greet>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question