Hi,
I'm new with angular and I'm trying to update my tool to a new version that use angular controllers.
I created all necessary files (treecontroller, manifest, controllers and html files) and I correctly see my new custom section, the tree and when I click on the User Cleanup treenode, I correctly view the title, subtitle and description.
Now I want to display all umbraco users into a table but I don't know how can I do that.
This is my actual code of my controller "Users-Cleanup.js"
'use strict';
(function () {
// Create Edit controller
function UsersCleanupController($scope, $routeParams, userService) {
// Set a property on the scope equal to the current route id
$scope.id = $routeParams.id;
$scope.title = "Users Manager";
$scope.subtitle = "Cleanup users";
$scope.description = "With this tool you can delete one or more users.";
var getCurrentUser = userService.getCurrentUser().then(function(userObj) {
var user = userObj;
$scope.currentUser = user.id;
});
var totalUsers = 0;
var allUsers = userService.GetAll;
$scope.allUsers = allUsers;
};
// Register the controller
angular.module("umbraco").controller("FALM.Housekeeping.UsersCleanupController", UsersCleanupController);
})();
This is the code of my view "Users-Cleanup.html"
<div ng-controller="FALM.Housekeeping.UsersCleanupController">
<umb-panel>
<umb-header>
<div class="umb-headline-editor-wrapper span12 ng-scope">
<h1 class="ng-binding">F.A.L.M. Housekeeping</h1>
</div>
</umb-header>
<umb-content>
<div class="umb-pane" style="margin-top: 120px;">
<div ng-switch="id">
<h2>{{title}}</h2>
<h3>{{subtitle}}</h3>
<h4>{{description}}</h4>
</div>
<div>
<!-- ### HERE I WANT TO INSERT THE TABLE WITH ALL USERS ### -->
</div>
</div>
</umb-content>
<umb-footer>
<div class="umb-dialog-footer">
<p style="margin: 20px;">Questo รจ il footer della pagina</p>
</div>
</umb-footer>
</umb-panel>
</div>
I had to modify the users resource file to call my custom methods and add the [PluginController("myCustomAPIController")] attribute to my UsersApiController.cs
How to get all users with angular
Hi, I'm new with angular and I'm trying to update my tool to a new version that use angular controllers.
I created all necessary files (treecontroller, manifest, controllers and html files) and I correctly see my new custom section, the tree and when I click on the User Cleanup treenode, I correctly view the title, subtitle and description.
Now I want to display all umbraco users into a table but I don't know how can I do that.
This is my actual code of my controller "Users-Cleanup.js"
This is the code of my view "Users-Cleanup.html"
What changes can I do to display all users?
Thank you for the help
Adriano
Hi Adriano,
don't know if you can do it with the entityResource but you can have a look at it. https://umbraco.github.io/Belle/#/api/umbraco.resources.entityResource
If not you can always call a custom API controller to get all user using the UserService.
Regards David
Hi David, thank you for your answer...I'm trying to create my custom API controller with my customs methods (including the "get all user" method).
How can I use those methods in my angular controller?
I must use a directive? You can give me an example please?
Thanks,
Adriano
OK finally I found the solution :-)
I had to modify the users resource file to call my custom methods and add the [PluginController("myCustomAPIController")] attribute to my UsersApiController.cs
Finally I see all users.
Thanks for support.
Adriano
is working on a reply...