简体   繁体   English

如何通过 Angularjs 中的控制器访问模板

[英]How to access the template through the controller in Angularjs

How to access the template through the controller in Angular Js如何通过 Angular Js 中的控制器访问模板

Thanks.谢谢。

You use ngInclude directive:您使用 ngInclude 指令:

<div ng-controller="YourCtrl"  ng-include="yourTemplateURL">

And set url inside YourCtrl:并在 YourCtrl 中设置 url:

$scope.yourTemplateURL= 'partials/template.html';

https://docs.angularjs.org/api/ng/directive/ngInclude https://docs.angularjs.org/api/ng/directive/ngInclude

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM