I'm searching for an alternative that is more "angular-ish" than my current solution:
I have defined in my app.js, amongst others, the following routes:
app.config(function ($routeProvider) {
$routeProvider
.when('/Table/:guid', {
templateUrl: 'views/table.html',
controller: 'TableCtrl',
controllerAs: 't'
})
.when('/Table/:guid/new', {
templateUrl: 'views/addPost.html',
controller: 'AddPostCtrl',
controllerAs: 'ap'
})
.otherwise({
redirectTo: '/'
});
});
And in my controller:
angular.module('acpApp')
.controller('TableCtrl', function ($scope, $location, $routeParams) {
var param = $routeParams.guid;
$scope.currentUrl = $location.absUrl();
}
And in my view:
<a ng-href="{{currentUrl}}/new" class="btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add post</a>
This works, but I don't feel like it is the angular way to do it - or is it? How can I anguliarize this?