modalCtrl.js
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(function(angular) {
function modalCtrl($scope, customerService,$uibModal, $uibModalInstance, $sce, $anchorScroll, $location, param, localStorageService) {
customerService.getVehicleDetailsById({
id: param.id
}, function(result){
if(result.returnCode == '0'){
$scope.detail = result.data;
angular.forEach($scope.detail, function(obj, key){
if (key == 'displacement') {
if (obj == null || obj == '') {
console.log(key)
$scope.detail[key] = '全部';
}
}
if(obj === 'null'){
$scope.detail[key] = null;
}
});
$scope.detail.remark = $sce.trustAsHtml($scope.detail.remark);
$scope.gotoMonitor = function(){
$uibModalInstance.dismiss(0);
var _str = angular.toJson({
sn: $scope.detail.insureDevice.sn
});
localStorageService.set('monitor.index', _str);
$location.path('/monitor/index');
}
}
});
$scope.goToBlock = function(index){
$location.hash('block'+index);
$anchorScroll();
$scope.navActiveIndex = index;
}
$scope.close = function(){
$uibModalInstance.dismiss(0);
}
}
angular.module('customer').controller('modalCtrl', modalCtrl);
})(angular);