I want to pass a value from my C#/Razor to angularJS.
I tried this:
{{isDashboardOpened=@((ViewContext.Controller.GetUserSettings(this.User).ShowDashboardOnLoad).ToString().ToLower());""}}
It didnt work well, because after this I can't change my variable any more.
Here is the rest of my code:
<li id="btnDashboard" ng-click="toggleDashboard()" ng-class="{'active':isDashboardOpened}">
<a href="#" onclick="return false;">
<span class="glyphicon glyphicon-dashboard" title="@ResourcesLocal.Widgets.Resources_WidgetBase.Dashboard"></span>
</a>
</li>
angular.module("frigodataOnline")
.controller("ProjectViewController", ["$scope", function ($scope) {
$scope.isDashboardOpened = false;
$scope.toggleDashboard = function () {
$scope.isDashboardOpened = !$scope.isDashboardOpened;
};
$scope.openDashboard = function () {
$scope.isDashboardOpened = true;
};
$scope.closeDashboard = function () {
$scope.isDashboardOpened = false;
};
}]);
When I havent implement my frst line (razor to ang) then my toggle work, if I implement it, the toggle doesnt work any more.