Create a Component



    Jose Romero

    Angular TypeScript Recipes

    The code in the @Component annotation defines the selector and templateUrl for a component. The constructor() method is also defined. ngOnInit() is called when the component is initialized.

    Library: angular

    Shortcut: angular.component

    import { Component, OnInit } from '@angular/core';
      selector: 'selector-name',
      templateUrl: 'name.component.html'
    export class NameComponent implements OnInit {
      constructor() { }
      ngOnInit() { }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.