Skip to content

Instantly share code, notes, and snippets.

View kevinchisholm's full-sized avatar

Kevin Chisholm kevinchisholm

View GitHub Profile
<p *ngIf="formEntry.name">The name is {{formEntry.name}} </p>
<p *ngIf="formEntry.address">The address is {{formEntry.address}} </p>
<p *ngIf="formEntry.phone">The phone number is {{formEntry.phone}} </p>
<p>The name is {{formEntry.name}} </p>
<p>The address is {{formEntry.address}} </p>
<p *ngIf="formEntry.phone">The phone number is {{formEntry.phone}} </p>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
firstFormEntry = {
id: 1,
<p>The name is {{formEntry.name}} </p>
<p>The address is {{formEntry.address}} </p>
<p>The phone number is {{formEntry.phone}} </p>
<app-first-child [formEntry]="firstFormEntry"></app-first-child>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
firstFormEntry = {
id: 1,
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-first-child',
templateUrl: './my-first.component.html',
styleUrls: ['./my-first.component.css']
})
export class MyFirstComponent {
@Input() formEntry;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyFirstAngularApplication</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<p>The Parent Component is the AppComponent</p>
<app-first-child></app-first-child>
<app-first-child></app-first-child>
<app-first-child></app-first-child>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyFirstAngularApplication</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>