Javascript 如何更改按钮clcik上的tempateurl

Javascript 如何更改按钮clcik上的tempateurl,javascript,angularjs,Javascript,Angularjs,我想在单击按钮时将tempateUrl从home.html更改为customer.html first2.directive('mycustomer', function() { return { restrict: "E", replace: 'true', template: 'home.html',//want to change this customer.html on button click

我想在单击按钮时将tempateUrl从home.html更改为customer.html

first2.directive('mycustomer', function() 
{
    return {
            restrict: "E",
            replace: 'true',
            template: 'home.html',//want to change this customer.html on button click
          }
});

这可能吗

假设您有两个名为aaa.html和bbb.html的模板。 如果您想在指令中动态地选择它们,您可以编写

app.directive('mycustomer', function(){
  return {
    templateUrl: function(el, attr) {
      return attr.template + '.html';
    }
  }
});
然后就这样叫他们

<div mycustomer template="aaa"></div>
<div mycustomer template="bbb"></div>


是否可以在一页中使用两个模块是否可以在一页中使用两个模块