Change attribute of custom directive
问题 I have custom directive to load pages inside a div .directive('page', function () { return { templateUrl: function (elem, attr) { return 'pages/page-' + attr.num + '.html'; } }; }); here is the dom representation of the custom directive <div page num="{{pageNo}}"></div> Here i want to change the page number from the controller. Directive works fine if the value added directly <div page num="1"></div> 回答1: As you want the interpolated value of pageNo inside your directive, You cant get that