I am new to angular and I am developing an application using REST
endpoints. I have two different endpoints. I have an app that allows user
to register for events. I have a button on the view with a
data-ng-click="registerForEvent(eventItem)". However, I need to get the
current user's claim identifier from a people REST endpoint before
submitting. How can I can add a call into people svc to get a value before
registering?
1. User Profile Endpoint (AccountName, ID, username, etc)
2. Registration List
My controller looks like this:
"use strict";
(function () {
angular.module("eventsApp")
.controller("viewEventCtrl", ["$scope", "eventsService",
"regService", "*peopleService*", "$routeParams", "$location",
function ($scope, eventsService, regService, *peopleService*,
$routeParams,$location) {
eventsService.getById($routeParams.eventId)
.then(function (response) {
$scope.eventItem = {
eventId : response.d.Id,
title: response.d.Title,
description: response.d.EventDescription,
location: response.d.Location,
startDate: response.d.StartDate,
endDate: response.d.OData__EndDate
};
$scope.keywords = response.d.Keywords.split(",");
Before the below code executes I want to make a call to
another endpoint to get the current users account name. I then want to pass
that as a parameter into the regService.AddNew function.
$scope.registerForEvent = function (eventItem) {
regService.addNew(eventItem)
.then(function (response) {
$location.path("/");
});
};
});
}]);
})();
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.