简体   繁体   English

在AngularJS配置中构建动态模板URL

[英]Building Dynamic Template URL in AngularJS config

I'm currently working on an ASP.NET MVC site. 我目前在ASP.NET MVC网站上工作。 Wherein there are different tenant users. 其中有不同的租户用户。

so if a user wants to view his tenant page he has his own unique slug name. 因此,如果用户想查看其租户页面,则他将拥有自己的唯一子名。

eg: www.xxxxx.com/(slugname) 例如:www.xxxxx.com/(slugname)

Now in AngularJS can I dynamically add this slugname to the templateUrl like templateUrl: 'Home/(slugname)/Test' in the config using $scope or ng-init or anything?. 现在在AngularJS中,我可以使用$ scope或ng-init或其他任何东西将此slugname动态添加到templateUrl中,例如templateUrl:'Home /(slugname)/ Test'在配置中。

I think you mean $location , something like: 我认为您的意思是$location ,类似:

 $location.path('/' + path).search(search);

See docs here 在这里查看文档

I think you are looking for Angular Dynamic Routing. 我认为您正在寻找Angular动态路由。 Please refer http://gregorypratt.github.io/AngularDynamicRouting/ for details. 有关详细信息,请参阅http://gregorypratt.github.io/AngularDynamicRouting/

Also refer this similar question on SO: AngularJS dynamic routing . 另请参阅SO上的类似问题: AngularJS动态路由

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

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