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

后端 未结 4 2266
情书的邮戳
情书的邮戳 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:27

    If you want to bind a dynamic url with href then you can manipulate you URL in ng-click or ng-mousedown event and bind to target element.

    JS:

    var goToLinkedPage = function (event, basePath, param1, param2, param 3) {
        var newState = basePath + "?" + param1 + "&" + param2 + "&" + param3;
        jQuery(event.target).attr('href',newState);
    };
    

    HTML:

     Click Here 
    

提交回复
热议问题