Skip to content

Commit

Permalink
feature: change template behaviour to allow angular expressions as te…
Browse files Browse the repository at this point in the history
…mplate-url (close #67)
  • Loading branch information
JohnnyTheTank committed Jan 20, 2016
1 parent b0e4c42 commit f719a5e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apiNG",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/JohnnyTheTank/apiNG",
"authors": [
"Jonathan Hornung <[email protected]>"
Expand Down
18 changes: 10 additions & 8 deletions dist/aping.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
@name: aping
@version: 1.0.1 (18-01-2016)
@version: 1.0.2 (20-01-2016)
@author: Jonathan Hornung <[email protected]>
@url: https://github.com/JohnnyTheTank/apiNG
@license: MIT
Expand All @@ -14,9 +14,8 @@ var apingApp = angular.module('jtt_aping', ['jtt_aping_jsonloader', 'jtt_aping_n
apingApiKeys: {}
});


}])
.directive('aping', ['apingDefaultSettings', 'apingUtilityHelper', function (apingDefaultSettings, apingUtilityHelper) {
.directive('aping', ['apingDefaultSettings', 'apingUtilityHelper', '$templateRequest', '$compile', function (apingDefaultSettings, apingUtilityHelper, $templateRequest, $compile) {
return {
restrict: 'E',
replace: 'false',
Expand All @@ -31,6 +30,13 @@ var apingApp = angular.module('jtt_aping', ['jtt_aping_jsonloader', 'jtt_aping_n
payloadJson: '@',
removeDoubles: '@'
},
link: function (scope, element, attrs) {
$templateRequest(scope.templateUrl || apingDefaultSettings.templateUrl).then(function (html) {
var template = angular.element(html);
element.append(template);
$compile(template)(scope);
});
},
controller: ['$scope', function ($scope) {
$scope.results = [];
$scope.payload = $scope.payloadJson ? apingUtilityHelper.replaceSingleQuotesAndParseJson($scope.payloadJson) : {};
Expand Down Expand Up @@ -147,13 +153,9 @@ var apingApp = angular.module('jtt_aping', ['jtt_aping_jsonloader', 'jtt_aping_n
this.apply = function () {
$scope.$apply();
};
}],
templateUrl: function (elem, scope) {
return scope.templateUrl || apingDefaultSettings.templateUrl;
}
}]
};
}]);

;"use strict";

angular.module('jtt_aping').service('apingTimeHelper', function () {
Expand Down
Loading

0 comments on commit f719a5e

Please sign in to comment.