Angular4: Pass data from parent to child component (part 5)

Set  up an ng project, $ ng new angularcomponentpassing Create a new component, $ ng g c cockpit File: cockpit.component.ts import { Component, OnInit, Input } from ‘@angular/core’; @Component({ selector: ‘app-cockpit’, templateUrl: ‘./cockpit.component.html’, styleUrls: [‘./cockpit.component.css’] }) export class CockpitComponent implements OnInit { @Input(‘srvElement’) element: {name: string, id: number;} constructor() { } ngOnInit() { } }…Read More

Simple Python into HTML

The following Python code will find instances of {body} in a file template.html and replace it with a string. Then a new file index.html is created with this change. with open(‘template.html’,’r’) as template_file: template = content = template tokens = {‘body’: ‘Body stuff can go here’} replaced = ‘Body stuff can go here.’…Read More