-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
53 lines (40 loc) · 1.42 KB
/
script.js
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
47
48
49
50
51
52
/**
* Created by Jayachandra on 4/24/19.
*/
var app = angular.module('myApp' ,[]);
app.controller("MainCtrl", function($scope, $http, $window){
$scope.isMobile = false;
$scope.isDesktop = false;
$scope.isTablet = false;
$scope.showProfileData = true;
$http.get("people.json").then(function(people) {
$scope.people = people.data.People;
$scope.profileData= function (person) {
$scope.selectedPerson = person;
$scope.selectedPerson.ratingArray = [];
$scope.selectedPerson.nratingArray = [];
for(var index = 0; index < $scope.selectedPerson.rating; index++){
$scope.selectedPerson.ratingArray.push(index+1);
}
var nonRating = 5 - $scope.selectedPerson.rating;
for(var index = 0; index < nonRating; index++){
$scope.selectedPerson.nratingArray.push(index+1);
}
}
if($window.innerWidth < 768){
$scope.isMobile = true;
$scope.showProfileData = false;
}
if($window.innerWidth >= 768 && $window.innerWidth <= 1024){
$scope.isTablet = true;
}if($window.innerWidth > 1024){
$scope.isDesktop = true;
}
$scope.profileData($scope.people[0])
$scope.test = function () {
if($window.innerWidth < 768){
$scope.showProfileData = true;
}
}
});
});