gpt4 book ai didi

javascript - Angular ui-router $位置

转载 作者:行者123 更新时间:2023-11-28 00:10:04 25 4
gpt4 key购买 nike

我正在尝试在 WordPress 单页面模板上实现 Angular ui-router。这是我的 app.js:

angular
.module('app', [
'ui.router'
])

.config(['$urlRouterProvider', '$stateProvider', function($urlRouterProvider, $stateProvider){
$urlRouterProvider.otherwise('/');

$stateProvider
.state ('home', {
url: '/',
templateUrl: '../../wp-content/themes/my_theme/templates/home.html'
})
.state ('about', {
url: '/about',
templateUrl: '../../wp-content/themes/my_theme/templates/about.html'
})
}])

现在我的问题是:如何用 Angular $location.path() 函数替换我的 templateUrl 以使我的脚本更加稳定?

最佳答案

是的,

我会在您的functions.php中使用get_template_directory_uri();将位置传递给您的应用程序。

关于javascript - Angular ui-router $位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30981391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com