efd22f0f39a04200f07ce53eddf09aab58d7d4f1
[portal/sdk.git] /
1 appDS2.controller('nbookController', ['$scope', '$location','$window','$http', function ($scope,$location,$window,$http) { 
2         $scope.keyValueList = [{}];
3         $scope.submitParameters = function() {
4                 $scope.iframevisibility = false;
5                 $scope.postData = {};
6                 $scope.additionalqueryParams = {};
7                 //Use this if there is only one 1 query param key value pair 
8                 $scope.additionalqueryParams.paramKey = $scope.qparamKey;
9                 $scope.additionalqueryParams.paramVal = $scope.qparamVal;
10                 var qryStr = '';
11                 for(var i = 0; i < $scope.keyValueList.length; i++) {
12                     var obj = $scope.keyValueList[i];
13                     if (obj.qK != undefined && obj.qV != undefined) { 
14                         if (qryStr!='')
15                                 qryStr = qryStr+'&'+obj.qK+'='+obj.qV;
16                             else
17                                 qryStr = obj.qK+'='+obj.qV;
18                     }
19                 }               
20                 var queryurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&'+qryStr;
21                 window.open (queryurl,'_self',false);
22         }
23         $scope.addKeyValuePairs = function (kv) {
24                 if ($scope.keyValueList.length < 9) {
25                         $scope.keyValueList.push({  
26                               });                       
27                 } else {
28                         document.getElementById("addbtn")["disabled"]  = true;
29                 }
30         }
31         $scope.removeKeyValuePairs = function (index) {
32                 $scope.keyValueList.splice(index, 1);
33                 if ($scope.keyValueList.length == 8) {
34                         document.getElementById("addbtn")["disabled"]  = false;
35                 }
36         }
37 }]);