How to bind a property to style.width in pixels?

前端 未结 4 1713
时光取名叫无心
时光取名叫无心 2021-02-05 00:10

I\'m using Angular 2 and I\'ve written the below code:

some texts

I\'ve also tried:

4条回答
  •  名媛妹妹
    2021-02-05 00:44

    Works fine for me

    Plunker example

    @Component({
      selector: 'my-app',
      styles: [`div { border: 3px solid red; }`]
      template: `
        

    Hello {{name}}

    some texts
    `, }) export class App { name:string; width: number = 250; constructor() { this.name = 'Angular2' } }

提交回复
热议问题