-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a440c48
commit bbcbb29
Showing
4 changed files
with
36 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "apiNG", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"homepage": "https://github.com/JohnnyTheTank/apiNG", | ||
"authors": [ | ||
"Jonathan Hornung <[email protected]>" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** | ||
@name: aping | ||
@version: 1.3.0 (09-03-2016) | ||
@version: 1.3.1 (12-03-2016) | ||
@author: Jonathan Hornung <[email protected]> | ||
@url: https://github.com/JohnnyTheTank/apiNG | ||
@license: MIT | ||
|
@@ -12,7 +12,6 @@ angular.module('jtt_aping', [ | |
'jtt_aping_local_storage', | ||
]);;"use strict"; | ||
angular.module('jtt_aping') | ||
|
||
.config(['$provide', function ($provide) { | ||
$provide.value("apingDefaultSettings", { | ||
apingApiKeys: {} | ||
|
@@ -36,8 +35,10 @@ angular.module('jtt_aping') | |
removeDoubles: '@', | ||
mergeDoubles: '@', | ||
idBy: '@', | ||
resultProperty: '@', | ||
valueName: '@' | ||
resultProperty: '@', // legacy | ||
resultName: '@', | ||
valueName: '@', | ||
protocol: '@' | ||
}, | ||
link: function (scope, element, attrs, controller, transcludeFn) { | ||
|
||
|
@@ -73,11 +74,15 @@ angular.module('jtt_aping') | |
}, | ||
controller: ['$scope', function ($scope) { | ||
|
||
if (angular.isUndefined($scope.resultProperty)) { | ||
$scope.resultProperty = "results"; | ||
if(angular.isUndefined($scope.resultName)) { | ||
if (angular.isUndefined($scope.resultProperty)) { | ||
$scope.resultName = "results"; | ||
} else { | ||
$scope.resultName = $scope.resultProperty; | ||
} | ||
} | ||
|
||
$scope[$scope.resultProperty] = []; | ||
$scope[$scope.resultName] = []; | ||
$scope.payload = $scope.payloadJson ? apingUtilityHelper.replaceSingleQuotesAndParseJson($scope.payloadJson) : {}; | ||
|
||
/** | ||
|
@@ -95,6 +100,7 @@ angular.module('jtt_aping') | |
var mergeDoubles; | ||
var valueName; | ||
var idBy; | ||
var protocol; | ||
|
||
|
||
if (angular.isDefined($scope.valueName)) { | ||
|
@@ -175,6 +181,14 @@ angular.module('jtt_aping') | |
idBy = undefined; | ||
} | ||
|
||
if (angular.isDefined($scope.protocol)) { | ||
protocol = $scope.protocol; | ||
} else if (angular.isDefined(apingDefaultSettings.protocol)) { | ||
protocol = apingDefaultSettings.protocol; | ||
} else { | ||
protocol = undefined; | ||
} | ||
|
||
return { | ||
model: $scope.model || apingDefaultSettings.model || "native", | ||
getNativeData: getNativeData, | ||
|
@@ -185,7 +199,8 @@ angular.module('jtt_aping') | |
removeDoubles: removeDoubles, | ||
mergeDoubles: mergeDoubles, | ||
idBy: idBy, | ||
valueName: valueName | ||
valueName: valueName, | ||
protocol: protocol | ||
}; | ||
}; | ||
|
||
|
@@ -195,11 +210,15 @@ angular.module('jtt_aping') | |
* @param _array | ||
*/ | ||
this.concatToResults = function (_array) { | ||
if (angular.isUndefined($scope.resultProperty)) { | ||
$scope.resultProperty = "results"; | ||
if(angular.isUndefined($scope.resultName)) { | ||
if (angular.isUndefined($scope.resultProperty)) { | ||
$scope.resultName = "results"; | ||
} else { | ||
$scope.resultName = $scope.resultProperty; | ||
} | ||
} | ||
|
||
var tempArray = $scope[$scope.resultProperty].concat(_array); | ||
var tempArray = $scope[$scope.resultName].concat(_array); | ||
|
||
var appSettings = this.getAppSettings(); | ||
|
||
|
@@ -250,9 +269,9 @@ angular.module('jtt_aping') | |
apingResults[appSettings.valueName] = tempArray; | ||
} | ||
|
||
$scope[$scope.resultProperty] = tempArray; | ||
$scope[$scope.resultName] = tempArray; | ||
|
||
$scope.$broadcast('apiNG.resultMerged', {'resultProperty': $scope.resultProperty}); | ||
$scope.$broadcast('apiNG.resultMerged', {'resultName': $scope.resultName}); | ||
}; | ||
this.apply = function () { | ||
$scope.$apply(); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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