Complete code in
math.directive.ts
After reading this you will be able to create a structural directive with inputs and context variables and use it like this:
<div *math="10; exponent: 3; let input;
let exponent = exponent; let r = root;
let p = power; let ctrl = controller">