Friday, May 17, 2013

How to use AJAX using Angular JS in Lotus notes

Hi All,

I have implemented the AJAX using Angular Js in Lotus notes. Here to go,

Scenario and Solution: 
   
    * I want to connect the backend view, and get the data in to JSON structure, Here i have used Angular JS, it is very simple.

 * Refer the below function, this was the strucuture of the code for calling AJAX in Angular Js, and
     i am passing the URL,
      and get the JSON,
      and customized the JSON ,
       and sending to Angular Scope variable,
      Using Scope variable i am easily fetching the details from front-end :)


function LoadJSONVal($scope,$http, $templateCache, $filter)
{
$scope.method = "GET"
$scope.url = "vwAppdetails?ReadViewEntries&outputformat=JSON&count=10000"
$http({method: $scope.method, url: $scope.url, cache: $templateCache}).
    success(function(data, status) {
                      $scope.status = status;
                      var AllVal = new Array();
   
                     for(var i=0; i<data.viewentry.length; i++)
                      {
                     AllVal[i] = {"AppName" : data.viewentry[i].entrydata[0].text[0], 
                                                    "Server" : data.viewentry[i].entrydata[1].text[0]
                                                    ,"Filepath" :data.viewentry[i].entrydata[2].text[0],
                                                      "Sponsor" : data.viewentry[i].entrydata[3].text[0],
                                                      "Suppteam" : data.viewentry[i].entrydata[4].text[0],
                       "UNID" : data.viewentry[i].entrydata[5].text[0],
                                                       "WebURL" : data.viewentry[i].entrydata[6].text[0]}           
     
        $scope.Value1.AppName=AllVal;

}

3 comments:

  1. Good to see Angular Js in lotus notes
    by Kishore

    ReplyDelete
  2. Thanks for the share Mahesh. How do I import AngularJS into Lotus Notes?

    I tried using Xpages and it was working fine without any errors on page. BTW how do I import AngularJS in a form. Please advise guys! I'm using Bootstrap also.

    ReplyDelete