错误:没有模块“myapp” [英] Error:no module "myapp"
问题描述
我试图将数据绑定到角度视图,但我在角度js参考中得到错误。
说明没有模块myApp。
这是我的代码:
use strict;
(function(){
var app = angular.module('myApp',[])。 controller('ExampleCtrl',['$ scope','$ location',函数($ scope,$ location){
var NHRID = $ location.search()。nhrid;
NHRID = JSON.parse(NHRID);
// =========== ====从列表中获取所有控件======================================== ========
var data1;
$ .ajax({
url:_spPageContextInfo.webAbsoluteUrl +/ _ api / web / lists / GetByTitle('CandidateIndia')/ items?$ filter = NHRID eq'+ NHRID +',
方法:GET,
header:{ 接受:application / json; odata = verbose},
成功:功能(数据)
{
data1 =数据。 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.EducationDetails);
},
错误:函数ajaxError(响应){
alert(response.status +''+ response.statusText);
}
});
查看代码:<
script src =https://ajax.googleapis.com /ajax/libs/angularjs/1.0.7/angular.min.js\"></script>
我尝试了什么:
我首先尝试放置angularjs参考链接。
也指定了ng -app,ng-controller。
scope','
Im trying to bind data to angular view but i'm getting error in angular js reference. 这篇关于错误:没有模块“myapp”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
scope,
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.scope','
location', function(
scope,