AngularJS, how to bind a variable to concatenation of two other bound variables?

后端 未结 4 2275
情书的邮戳
情书的邮戳 2021-02-20 09:01

I am new to AngularJS and trying to build an AngularJS practice app, in which, the user will concatenate a url from multiple inputs, i.e. protocol, domain, path, param1, param2,

4条回答
  •  一生所求
    2021-02-20 09:07

    Another similar approach is to use ng-init directive to create a dynamic property which represents the concatenation of all those properties. You can call the function or just concatenate inline.

     {{urlParts.url}}
    
    
    {{urlParts.url}}
        
    

    Reference: http://www.ozkary.com/2015/03/angularjs-ng-model-concatenate-model.html

    Try It: http://plnkr.co/edit/PSvwCE?p=info

提交回复
热议问题