I am using AngularJS with Angular Strap plugin for one of my projects. On the page I have a table. One of the columns contains some links.
After clicking on the link I pop-ups Angular Strap's dropdown (as contextual menu).
This menu contains two items:
- details,
- board.
Clicking on details item open-ups Angular Strap's aside (with some data to be shown) - this one is working well.
The problem is, the second item should redirects to a specific page (using dropdown's href attribute). My question is - how to use angular expression in this href attribute?
Part of my view's code - with dropdown:
<button type="button" class="btn btn-link"
ng-click="selectGroup(group)"
data-html="1"
data-animation="am-flip-x"
data-placement="bottom",
bs-dropdown="dropdown">
{{ group.name }}
</button>
Bs-dropdown's dropdown definitions from controller:
$scope.dropdown = [
{
text: "Details",
click: "showDetails()" // Opens up Angular Strap's aside.
},
{
text: "Board",
href: "/group/{{ $scope.group.number }}" // Not evaluated.
}
];
Clicking on "Board" dropdown's item is redirecting to something like: "127.0.0.1:8000/#/group/{{group.number}}" rather than (i.e.) "127.0.0.1:8000/#/group/2".
As a workaround I have created another method (i.e.) openBoard() as follows:
var openBoard = function() {
var groupNumber = $scope.group.number;
window.location.href="127.0.0.1:8000/#/" + groupNumber;
}
Calling this method in "Board" item's click is working, but causes some other problems and more - is not the way I want to go (semantically incorrect).
One more thing at the end. Whenever page loads (and controller has been initialized) value stored in $scope.group is undefined. I am setting a proper value whenever group link (from above mentioned table) is being clicked (and a moment before dropdown is displayed).
Anyone has any ideas how to use Angular expressions with Angular Strap's dropdown (in href)?
href: "/group/" + $scope.group.number".{ text: "Board", href: "/group/"+$scope.group.number }group?