Is there a way to use math functions in angular2 bindings?
example
<div class="partition-panel">
<b class="pull-left">{{Math.round(variable/12*2)}}</b>
<b class="pull-right">{{Math.round(variable/12*2)}}</b>
</div>
when try to use this i got error
Cannot read property 'round' of undefined
Also the similar question is answered for angular1
You can try this :
@Component({
selector: 'my-app',
template: `
<div>
<h2>Hello {{Math.round(number)}}</h2>
</div>
`,
})
export class App {
Math = Math;
number = 2.5;
}