Im trying to bind data to angular view but i'm getting error in angular js reference.
Stating that No Module "myApp".
Here is My code:
"use strict";
(function(){
var app=angular.module('myApp',[]).controller('ExampleCtrl',['$scope','$location', function($scope,$location){
var NHRID=$location.search().nhrid;
NHRID=JSON.parse(NHRID);
//===============get all controls from the list================================================
var data1;
$.ajax({
url:_spPageContextInfo.webAbsoluteUrl+"/_api/web/lists/GetByTitle('CandidateIndia')/items?$filter=NHRID eq '"+ NHRID+"'",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data)
{
data1=data.d.results;
$scope.data=data1[0];
$scope.data.Siblings=JSON.parse($scope.data.Siblings);
$scope.data.FamilyDetails=JSON.parse($scope.data.FamilyDetails);
$scope.items=JSON.parse($scope.data.EmploymentDetails);
$scope.data.EducationalDetails=JSON.parse($scope.data.EducationalDetails);
},
error: function ajaxError(response) {
alert(response.status + ' ' + response.statusText);
}
});
View Code:<
script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
What I have tried:
I tried of placing angularjs reference link in first.
also specified ng-app,ng-controller.