行きたいとき
http://www.koran-auf-deutsch.de/koran-deutsch/23-die-glaubigen-al-mominun/
そして入力するだけ
http://www.koran-auf-deutsch.de/koran-deutsch/23
URLに直接アクセスします。私のAngularアプリで同様の動作を得たいのですが、その機能をどこに注入しますか? 何か案は?
angular.module('app', []).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/:id', {controller: RedirectCtrl}).
when('/:id/:title', {templateUrl: 'partials/post.html', controller: PostCtrl}).
otherwise({redirectTo: '/404'});
}]);
function RedirectCtrl($routeParam, $http) {
var post_id = $routeParams.id;
// get title by id
$http.get('/api_url_to_get_title_by_id').success(function (data) {
window.location = "/" + post_id + "/" + data.title;
});
}
RedirectCtrl.$inject = ['$routeParams', '$http'];