Angular 2: Difference between property binding with and without brackets?

后端 未结 5 533
失恋的感觉
失恋的感觉 2020-12-16 10:39

I noticed it\'s possible to property bind stuff without brackets. What is the difference?

Typescript:

import { Component, Input } from \'@angular/cor         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-16 11:30

    There are some Cases where we need to add like this html attributes dynamically might be and example which comes json from api request

    Case 1 [] known as Property Binding

    
    

    Case 2 {{ }} known as Interpolation

    
    

    Case 3 Conditional handling

    
    

    Both {{ }} called as Interpolation and [] called as Property Binding means angular understand that there is One-way from data source to view target.

    For more visit www.codementor.io

提交回复
热议问题