Created
October 24, 2014 00:56
-
-
Save msadoon/11361575c735699d9e06 to your computer and use it in GitHub Desktop.
angular.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bugSummaryApp = angular.module('bugSummaryApp', []); | |
bugSummaryApp.factory('bugFactory', function($http) { | |
var webserviceURL = "/invokeWebService?webserviceHost=http://trceit-dev-env.elasticbeanstalk.com:8080&webservicePathURL=/getData"; | |
var filteredResponse = []; | |
var bugFactory = { | |
async: function() { | |
var promise = $http.get(webserviceURL).then(function (response) { | |
angular.forEach(response.data, function(bug) | |
{ | |
if (angular.isDefined(bug.OSVersion) && angular.isDefined(bug.appName) && angular.isDefined(bug.appVersion) && angular.isDefined(bug.deviceName)) | |
{ | |
filteredResponse.push(bug) | |
} | |
}); | |
return filteredResponse; | |
}); | |
return promise; | |
} | |
}; | |
return bugFactory; | |
}); | |
bugSummaryApp.service('bugService', function(bugIn) { | |
this.bug = bugIn; | |
}); | |
bugSummaryApp.controller('bugSummaryCtrl1', function(bugService, bugFactory, $scope){ | |
bugFactory.async().then(function(d) { | |
$scope.bugs = d | |
}); | |
$scope.idSelectedBug = null; | |
var ddt = null; | |
$scope.setSelected = function (idSelectedBug) { | |
$scope.data = idSelectedBug; | |
bugService($scope.data); | |
}; | |
}); | |
bugSummaryApp.controller('bugDetailCtrl1', function(bugService, $scope){ | |
$scope.bugService = bugService; | |
}); |
sanfords
commented
Oct 24, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment