Uncaught ReferenceError: angular is not defined using type script
Uncaught ReferenceError: angular is not defined using type script
我正在使用 Type Script 和 Angular js 我已经实现了一个名为快速搜索的控制器,我正在尝试执行搜索操作。我正在文本中获取搜索词来自我的 aspx 的框,然后点击 ng,它将转到我的控制器,然后它将数据放入 web api 方法,然后 return 返回到网格。
但我面临问题是因为
未捕获的 ReferenceError:angular 未定义
我在下面写了我的控制器代码:-
/// <reference path="../interface/interface.ts" />
/// <reference path="../../scripts/typings/jquery/jquery.d.ts" />
/// <reference path="../../scripts/typings/angularjs/angular.d.ts" />
module CustomerSearch.CustomerCtrl {
export class CustomerCtrl {
static $inject = ['$scope', '$http', '$templateCache'];
constructor(protected $scope: ICustomerScope,
protected $http: ng.IHttpService,
protected $templateCache: ng.ITemplateCacheService) {
$scope.search = this.search;
console.log(angular.element($scope).scope());
}
public search = (search: any) => {
debugger;
var Search = {
ActId: search.txtAct,
checkActiveOnly: search.checkActiveOnly,
checkParentsOnly: search.checkParentsOnly,
listCustomerType: search.listCustomerType
};
this.$scope.customer = [];
this.$scope.ticket = [];
this.$scope.services = [];
this.$http.put('<%=ResolveUrl("/API/Search/PutDoSearch")%>', Search).
success((data, status, headers, config) => {
debugger;
this.$scope.cust_File = data[0].customers;
this.$scope.ticket_file = data[0].tickets;
this.$scope.service_file = data[0].services;
}).
error((data, status) => {
console.log("Request Failed");
});
}
}
var customerapp = angular.module("CustomerSearch", []);
customerapp.controller('CustomerCtrl',["$scope", CustomerCtrl]);
}
我通过更改 java 脚本引用的顺序解决了这个问题。
如:-
1.jquery-latest.js
2.app.module.js"
3.Controller.js"
4.Interface.js"
5.angular.js"
6.angular.min.js"
7.app.routes.js"
我正在使用 Type Script 和 Angular js 我已经实现了一个名为快速搜索的控制器,我正在尝试执行搜索操作。我正在文本中获取搜索词来自我的 aspx 的框,然后点击 ng,它将转到我的控制器,然后它将数据放入 web api 方法,然后 return 返回到网格。 但我面临问题是因为 未捕获的 ReferenceError:angular 未定义 我在下面写了我的控制器代码:-
/// <reference path="../interface/interface.ts" />
/// <reference path="../../scripts/typings/jquery/jquery.d.ts" />
/// <reference path="../../scripts/typings/angularjs/angular.d.ts" />
module CustomerSearch.CustomerCtrl {
export class CustomerCtrl {
static $inject = ['$scope', '$http', '$templateCache'];
constructor(protected $scope: ICustomerScope,
protected $http: ng.IHttpService,
protected $templateCache: ng.ITemplateCacheService) {
$scope.search = this.search;
console.log(angular.element($scope).scope());
}
public search = (search: any) => {
debugger;
var Search = {
ActId: search.txtAct,
checkActiveOnly: search.checkActiveOnly,
checkParentsOnly: search.checkParentsOnly,
listCustomerType: search.listCustomerType
};
this.$scope.customer = [];
this.$scope.ticket = [];
this.$scope.services = [];
this.$http.put('<%=ResolveUrl("/API/Search/PutDoSearch")%>', Search).
success((data, status, headers, config) => {
debugger;
this.$scope.cust_File = data[0].customers;
this.$scope.ticket_file = data[0].tickets;
this.$scope.service_file = data[0].services;
}).
error((data, status) => {
console.log("Request Failed");
});
}
}
var customerapp = angular.module("CustomerSearch", []);
customerapp.controller('CustomerCtrl',["$scope", CustomerCtrl]);
}
我通过更改 java 脚本引用的顺序解决了这个问题。 如:-
1.jquery-latest.js
2.app.module.js"
3.Controller.js"
4.Interface.js"
5.angular.js"
6.angular.min.js"
7.app.routes.js"