我想将链接href属性绑定到我的控制器中的变量,但我也想将该url绑定到变量.我想使用内置绑定完成此操作,而无需手动监视更改并重新加载URL.这可能吗?
// In the controller
$scope.section = 'section1';
$scope.page = 'page1';
$scope.url = 'http://myurl/{{section}}/{{page}}';
<!-- In the template -->
<a ng-href="{{url}}">Page Link</a>
Run Code Online (Sandbox Code Playgroud)
这是我实际代码的简化.声明模板中的url模式会起作用,但我需要在传入的字符串中定义url.