我正在尝试在 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/