resolved by using $scope to pass parameter, please see following sample code. But I am still do not know what's the problem when I use resolver to pass parameter.
in index.js
$scope.editRoleId = 0;
vm.showEditRoleDialog = function (roleId) {
$scope.editRoleId = roleId;
var modalInstance = $modal.open({
templateUrl: abp.appPath + 'App/Main/views/roles/editDialog.cshtml',
controller: 'app.views.roles.editDialog as vm',
size: 'md',
scope:$scope,
});
modalInstance.result.then(function () {
vm.loadRoles();
});
};
in modalDialog.js
(function () {
var controllerId = 'app.views.roles.editDialog';
angular.module('app').controller(controllerId, [
'abp.services.app.role', '$modalInstance','$scope',
function (roleService, $modalInstance,$scope) {
var vm = this;
vm.editRoleId = $scope.editRoleId;
}
]);
})();
I found there is an error thrown 'Uncaught TypeError: Cannot read property 'push' of undefined '
Hi,
I make changes to:
resolve:
{
id: function () { return roleId; }
},
But the value of parameter id still not be passed. Any advice?
a sample for building sub-menu Question Administration ----Users
Sample code in NavigationProvider
context.Manager.MainMenu
.AddItem(
new MenuItemDefinition(
"Questions",
new LocalizableString("Questions", BOMConsts.LocalizationSourceName),
url: "#/questions",
icon: "fa fa-question"
)
)
.AddItem(
new MenuItemDefinition(
"Administration",
new LocalizableString("Administration", BOMConsts.LocalizationSourceName),
url:"",
icon: "fa fa-cogs"
).AddItem(
new MenuItemDefinition(
"Users",
new LocalizableString("Users", BOMConsts.LocalizationSourceName),
url: "#/users",
icon: "fa fa-users"
)
)
);
Routing in app.js:
//Configuration for Angular UI routing.
app.config([
'$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/questions');
$stateProvider
.state('questions', {
url: '/questions',
templateUrl: abp.appPath + 'App/Main/views/questions/index.cshtml',
menu: 'Questions' //Matches to name of 'Questions' menu in BOMNavigationProvider
})
.state('questionDetail', {
url: '/questions/:id',
templateUrl: abp.appPath + 'App/Main/views/questions/detail.cshtml',
menu: 'Questions' //Matches to name of 'Questions' menu in BOMNavigationProvider
})
.state('users', {
url: '/users',
templateUrl: abp.appPath + 'App/Main/views/users/index.cshtml',
menu: 'Users' //Matches to name of 'Users' menu in BOMNavigationProvider
});
}
]);
layout/header.cshtml
<ul class="nav navbar-nav">
<li ng-repeat="menuItem in vm.menu.items" ng-class="{active: vm.currentMenuName == menuItem.name}">
<a ng-if="menuItem.items.length==0" ng-href="{{menuItem.url}}"><i class="{{menuItem.icon}}" ng-if="menuItem.icon"></i> {{menuItem.displayName}}</a>
<a ng-if="menuItem.items.length>0" href="" data-toggle="dropdown"><i class="{{menuItem.icon}}" ng-if="menuItem.icon"></i> {{menuItem.displayName}} </a>
<ul ng-if="menuItem.items.length>0" class="dropdown-menu">
<li ng-repeat="menuSubItem in menuItem.items">
<a ng-href="{{menuSubItem.url}}"><i class="{{menuSubItem.icon}}" ng-if="menuSubItem.icon"></i> {{menuSubItem.displayName}}</a>
</li>
</ul>
</li>
</ul>
Thanks langman66.
I have went through the sample project Module Zero. Yes as you said, it do hit the MVC AccountController Login action first that gives me back a token. The browser (or any other device has to ) will then send along all the token in the header values of each request to any APIs. Ok, then let’s see, In the sample project, we can get the token by hitting the MVC accountcontroller login action, but if I invoke the authorized web api in an console application by posting HttpWebRequest, how do I get the token and send the token in the header of the HttpWebRequest?
As my assume, If I need to get the token, I need to invoke an account/login web api to get it. But in the sample module zero project, it is a MVC accountcontroller login action. I have thought move the coding of MVC accountcontroller login action to web api/application layer, but the web api is dynamic generated in the abp framework, I have tried, but failed.
Look forward your advice, do you have a sample of invoking an authorized api in other application, such as an console application using post HttpWebRequest.
Do you have any suggestion?
Is there a way that I invoke the authenticated ASP.net Web API on Mobility side? For example, an android application or an HTM5 based mobility application?
Thanks. I will try.
My pleasure.