Ich habe Access-Navigation mit $scope
gemacht und ich habe sie basierend auf Klick und ich tat. Ich kann URL in Variable nicht einstellen. Die richtige URL lautet http://www.example.com/base/index
oder http://www.example.com/base/thread
oder http://www.example.com/base/tag
. Aber das Ergebnis ist immer `http://www.example.com/base/index sogar gedacht, ich klickte eine andere Navigation.
Nachdem ich mein Problem suche, ist die Antwort machen $routeProvider
und $location
. Kann ich $scope
verwenden und die URL in $ scope setzen?
Dies ist mein Code:
$scope.states = {};
$scope.states.activeItem = 'nav1';
$scope.items = [{
id: 'nav1',
target: 'home',
title: 'Home',
icon: 'fa fa-home fa-3x'
}, {
id: 'nav2',
target: 'thread',
title: 'Thread + Answer',
icon: 'fa fa-briefcase fa-3x'
}, {
id: 'nav3',
target: 'tag',
title: 'Tag',
icon: 'fa fa-briefcase fa-3x'
},
{
id: 'nav4',
target: 'trending_tag',
title: 'Trending Tag',
icon: 'fa fa-briefcase fa-3x'
},
{
id: 'nav5',
target: 'category',
title: 'Category',
icon: 'fa fa-briefcase fa-3x'
},
{
id: 'nav6',
target: 'user',
title: 'User',
icon: 'fa fa-user-circle-o fa-3x'
}];
$scope.callToAction = function(actionName){
if($scope[actionName]){
$scope[actionName]();
}else{
alert("YOUR PAGE NOT FOUND BECAUSE AKU BELUM BUAT PAGE NYA HEHE");
}
};
By the way, $scope.items
meiner Navigation auszuführen.
Soweit es scheint, Sie erstellt einen Code wollte die aktive URL im Menü oder etwas zeigen, nicht wahr? – SPViradiya
Ja, hast du recht. Aber ich bin verwirrt zu setzen URL wenn Sie auf diese Weise. – userpr