[英]Angular ui-router $location
我正在嘗試在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
以使腳本更穩定?
是,
我會使用get_template_directory_uri();
在您的functions.php中將位置傳遞給您的應用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.