How to set params in $http GET method to send data from dropdown Angularjs












2














I have a modal window for creating new object (see image). As you can see there three forms: 1) simple input to create "Name";
2) A dropdown with "Types" ;
3) A dropdown with "Ids";
I need to get data with types and Ids from DB, and as I can see in the browser and logs this part of process is going well, but when I fill all the forms and try to send them, there is always appears an Error, it happens because on server in variables "Types" and "IDs" written data from variable "Name", in short words it sent the data from input to all variables. This is a main question - why do it write data from input to all variables?? This is the html:



 <tr>
<td class="collapsing">
<label>{{localization.common[locale].name}}</label>
</td>
<td>
<input type="text" placeholder="" ng-model="Name">
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].VTypeID}}</label>
</td>
<td>
<select class="ui dropdown VTypeID" ng-model="VTypeID">
<option ng-repeat="item in virtualType" value= "'{{item.Id}}'">{{item.Name}}</option>
</select>
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].account}}</label>
</td>
<td>
<select class="ui dropdown RunAsId" ng-model="RunAsId">
<option ng-repeat="list in runAccount" value= "'{{list.RunAsAccountId}}'">{{list.RunAsAccountName}}</option>
</select>
</td>
....
<div class="ui button blue" ng-click="createData(modal_id, Name, VTypeID, RunAsId)">{{localization.common[locale].add}}</div>


I had the same problem with creating "Account"(you can see on the image on left side menu: VirtualTypes, Account, VirtualConnectors), and there the issue was about $http params in controller



$scope.createData = function (obj, data, extra) {
....
if ($scope.dictFilter == 'accounts') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_RunAsAccount',
params: { name: data, pasword: data}
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
});
return;
} ....


When I replace 'password:data' to 'password:extra' the problem was solved, but with "VirtualConnectors" I couldn't find the way to do this (all creating processes are initializes by function "createData", and I am trying to add new block to that function)



if ($scope.dictFilter == 'virtualConnectors') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
params: {name: data, VtypeID: data, RunAsID:data }
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
console.log("function createData doesn't callback");
});
return;
}


maybe it's about params, in this case there three of them (actually 4, including obj "modal"), but function acccept only 2 arguments (actually 3 -including "obj"), the function works for other cases, and in other cases params do not always fit to arguments... In internet not much information about "params", so I can't understand the logic of binding html and controller here. Obviously, in html-file function CreateData take "modal_id", "Name", "VtypeID" and "RunAsId" as arguments so in the controller this function should be set with arguments that can take such types of data (obj, string, string, string), but there is (obj, data, extra), I've tried to change function arguments in the controller: $scope.createData = function (obj, data, extra, string) {... and it doesn't help... I think I should write another function for this case, but what arguments should I put? And one more thing: is it right to use form with options created by ng-repeat for such case (when I need to send a string that is a property of an object)?










share|improve this question




















  • 1




    Hey Dasha, I am not able to understand what's the actual question. Can you please correct the sentence and be more clear about your question. That being said, I can see ng-click="createData(modal_id, Name, VTypeID, RunAsId)" has 4 params where as in your js file $scope.createData = function (obj, data, extra) { is only able to handle 3 arguments. Please check if that's not the issue and let me know :)
    – Shashank Vivek
    Nov 14 '18 at 16:43










  • Shashank Vivek, thank you for answer. You are right, of course, but how should I fix it? I'm sorry if it's hard to understand my explanation, english is not my first language. I've added a picture, and rewrited the question.
    – Dasha Custo
    Nov 15 '18 at 11:22










  • Did my answer helped ?
    – Shashank Vivek
    Nov 20 '18 at 16:52










  • Sorry, but no =(
    – Dasha Custo
    Nov 21 '18 at 7:36










  • Sorry, but no =( when I call the function in html it nust have 4 params (with modal_id) because modal_id tell to the function what condition to take (the function is structured by "if"-blocks, and without modal_id function doesn't knoe what block to produce, so it shows log "data undefined"). Also I shouldn't put modal_id to the arguments (I've tried, it brings error). Your advice seems very logical to me, but it doesnt work. This app was created by another man, and I just trying to follow his logic, everything works, and this function working perfectly, I just need to understand this logic
    – Dasha Custo
    Nov 21 '18 at 7:51
















2














I have a modal window for creating new object (see image). As you can see there three forms: 1) simple input to create "Name";
2) A dropdown with "Types" ;
3) A dropdown with "Ids";
I need to get data with types and Ids from DB, and as I can see in the browser and logs this part of process is going well, but when I fill all the forms and try to send them, there is always appears an Error, it happens because on server in variables "Types" and "IDs" written data from variable "Name", in short words it sent the data from input to all variables. This is a main question - why do it write data from input to all variables?? This is the html:



 <tr>
<td class="collapsing">
<label>{{localization.common[locale].name}}</label>
</td>
<td>
<input type="text" placeholder="" ng-model="Name">
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].VTypeID}}</label>
</td>
<td>
<select class="ui dropdown VTypeID" ng-model="VTypeID">
<option ng-repeat="item in virtualType" value= "'{{item.Id}}'">{{item.Name}}</option>
</select>
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].account}}</label>
</td>
<td>
<select class="ui dropdown RunAsId" ng-model="RunAsId">
<option ng-repeat="list in runAccount" value= "'{{list.RunAsAccountId}}'">{{list.RunAsAccountName}}</option>
</select>
</td>
....
<div class="ui button blue" ng-click="createData(modal_id, Name, VTypeID, RunAsId)">{{localization.common[locale].add}}</div>


I had the same problem with creating "Account"(you can see on the image on left side menu: VirtualTypes, Account, VirtualConnectors), and there the issue was about $http params in controller



$scope.createData = function (obj, data, extra) {
....
if ($scope.dictFilter == 'accounts') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_RunAsAccount',
params: { name: data, pasword: data}
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
});
return;
} ....


When I replace 'password:data' to 'password:extra' the problem was solved, but with "VirtualConnectors" I couldn't find the way to do this (all creating processes are initializes by function "createData", and I am trying to add new block to that function)



if ($scope.dictFilter == 'virtualConnectors') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
params: {name: data, VtypeID: data, RunAsID:data }
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
console.log("function createData doesn't callback");
});
return;
}


maybe it's about params, in this case there three of them (actually 4, including obj "modal"), but function acccept only 2 arguments (actually 3 -including "obj"), the function works for other cases, and in other cases params do not always fit to arguments... In internet not much information about "params", so I can't understand the logic of binding html and controller here. Obviously, in html-file function CreateData take "modal_id", "Name", "VtypeID" and "RunAsId" as arguments so in the controller this function should be set with arguments that can take such types of data (obj, string, string, string), but there is (obj, data, extra), I've tried to change function arguments in the controller: $scope.createData = function (obj, data, extra, string) {... and it doesn't help... I think I should write another function for this case, but what arguments should I put? And one more thing: is it right to use form with options created by ng-repeat for such case (when I need to send a string that is a property of an object)?










share|improve this question




















  • 1




    Hey Dasha, I am not able to understand what's the actual question. Can you please correct the sentence and be more clear about your question. That being said, I can see ng-click="createData(modal_id, Name, VTypeID, RunAsId)" has 4 params where as in your js file $scope.createData = function (obj, data, extra) { is only able to handle 3 arguments. Please check if that's not the issue and let me know :)
    – Shashank Vivek
    Nov 14 '18 at 16:43










  • Shashank Vivek, thank you for answer. You are right, of course, but how should I fix it? I'm sorry if it's hard to understand my explanation, english is not my first language. I've added a picture, and rewrited the question.
    – Dasha Custo
    Nov 15 '18 at 11:22










  • Did my answer helped ?
    – Shashank Vivek
    Nov 20 '18 at 16:52










  • Sorry, but no =(
    – Dasha Custo
    Nov 21 '18 at 7:36










  • Sorry, but no =( when I call the function in html it nust have 4 params (with modal_id) because modal_id tell to the function what condition to take (the function is structured by "if"-blocks, and without modal_id function doesn't knoe what block to produce, so it shows log "data undefined"). Also I shouldn't put modal_id to the arguments (I've tried, it brings error). Your advice seems very logical to me, but it doesnt work. This app was created by another man, and I just trying to follow his logic, everything works, and this function working perfectly, I just need to understand this logic
    – Dasha Custo
    Nov 21 '18 at 7:51














2












2








2







I have a modal window for creating new object (see image). As you can see there three forms: 1) simple input to create "Name";
2) A dropdown with "Types" ;
3) A dropdown with "Ids";
I need to get data with types and Ids from DB, and as I can see in the browser and logs this part of process is going well, but when I fill all the forms and try to send them, there is always appears an Error, it happens because on server in variables "Types" and "IDs" written data from variable "Name", in short words it sent the data from input to all variables. This is a main question - why do it write data from input to all variables?? This is the html:



 <tr>
<td class="collapsing">
<label>{{localization.common[locale].name}}</label>
</td>
<td>
<input type="text" placeholder="" ng-model="Name">
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].VTypeID}}</label>
</td>
<td>
<select class="ui dropdown VTypeID" ng-model="VTypeID">
<option ng-repeat="item in virtualType" value= "'{{item.Id}}'">{{item.Name}}</option>
</select>
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].account}}</label>
</td>
<td>
<select class="ui dropdown RunAsId" ng-model="RunAsId">
<option ng-repeat="list in runAccount" value= "'{{list.RunAsAccountId}}'">{{list.RunAsAccountName}}</option>
</select>
</td>
....
<div class="ui button blue" ng-click="createData(modal_id, Name, VTypeID, RunAsId)">{{localization.common[locale].add}}</div>


I had the same problem with creating "Account"(you can see on the image on left side menu: VirtualTypes, Account, VirtualConnectors), and there the issue was about $http params in controller



$scope.createData = function (obj, data, extra) {
....
if ($scope.dictFilter == 'accounts') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_RunAsAccount',
params: { name: data, pasword: data}
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
});
return;
} ....


When I replace 'password:data' to 'password:extra' the problem was solved, but with "VirtualConnectors" I couldn't find the way to do this (all creating processes are initializes by function "createData", and I am trying to add new block to that function)



if ($scope.dictFilter == 'virtualConnectors') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
params: {name: data, VtypeID: data, RunAsID:data }
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
console.log("function createData doesn't callback");
});
return;
}


maybe it's about params, in this case there three of them (actually 4, including obj "modal"), but function acccept only 2 arguments (actually 3 -including "obj"), the function works for other cases, and in other cases params do not always fit to arguments... In internet not much information about "params", so I can't understand the logic of binding html and controller here. Obviously, in html-file function CreateData take "modal_id", "Name", "VtypeID" and "RunAsId" as arguments so in the controller this function should be set with arguments that can take such types of data (obj, string, string, string), but there is (obj, data, extra), I've tried to change function arguments in the controller: $scope.createData = function (obj, data, extra, string) {... and it doesn't help... I think I should write another function for this case, but what arguments should I put? And one more thing: is it right to use form with options created by ng-repeat for such case (when I need to send a string that is a property of an object)?










share|improve this question















I have a modal window for creating new object (see image). As you can see there three forms: 1) simple input to create "Name";
2) A dropdown with "Types" ;
3) A dropdown with "Ids";
I need to get data with types and Ids from DB, and as I can see in the browser and logs this part of process is going well, but when I fill all the forms and try to send them, there is always appears an Error, it happens because on server in variables "Types" and "IDs" written data from variable "Name", in short words it sent the data from input to all variables. This is a main question - why do it write data from input to all variables?? This is the html:



 <tr>
<td class="collapsing">
<label>{{localization.common[locale].name}}</label>
</td>
<td>
<input type="text" placeholder="" ng-model="Name">
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].VTypeID}}</label>
</td>
<td>
<select class="ui dropdown VTypeID" ng-model="VTypeID">
<option ng-repeat="item in virtualType" value= "'{{item.Id}}'">{{item.Name}}</option>
</select>
</td>
</tr>
<tr ng-controller="VirtualConnectorAddCtrl">
<td class="collapsing">
<label>{{localization.common[locale].account}}</label>
</td>
<td>
<select class="ui dropdown RunAsId" ng-model="RunAsId">
<option ng-repeat="list in runAccount" value= "'{{list.RunAsAccountId}}'">{{list.RunAsAccountName}}</option>
</select>
</td>
....
<div class="ui button blue" ng-click="createData(modal_id, Name, VTypeID, RunAsId)">{{localization.common[locale].add}}</div>


I had the same problem with creating "Account"(you can see on the image on left side menu: VirtualTypes, Account, VirtualConnectors), and there the issue was about $http params in controller



$scope.createData = function (obj, data, extra) {
....
if ($scope.dictFilter == 'accounts') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_RunAsAccount',
params: { name: data, pasword: data}
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
});
return;
} ....


When I replace 'password:data' to 'password:extra' the problem was solved, but with "VirtualConnectors" I couldn't find the way to do this (all creating processes are initializes by function "createData", and I am trying to add new block to that function)



if ($scope.dictFilter == 'virtualConnectors') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
params: {name: data, VtypeID: data, RunAsID:data }
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
console.log("function createData doesn't callback");
});
return;
}


maybe it's about params, in this case there three of them (actually 4, including obj "modal"), but function acccept only 2 arguments (actually 3 -including "obj"), the function works for other cases, and in other cases params do not always fit to arguments... In internet not much information about "params", so I can't understand the logic of binding html and controller here. Obviously, in html-file function CreateData take "modal_id", "Name", "VtypeID" and "RunAsId" as arguments so in the controller this function should be set with arguments that can take such types of data (obj, string, string, string), but there is (obj, data, extra), I've tried to change function arguments in the controller: $scope.createData = function (obj, data, extra, string) {... and it doesn't help... I think I should write another function for this case, but what arguments should I put? And one more thing: is it right to use form with options created by ng-repeat for such case (when I need to send a string that is a property of an object)?







javascript html angularjs html5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 17:16

























asked Nov 14 '18 at 16:15









Dasha Custo

214




214








  • 1




    Hey Dasha, I am not able to understand what's the actual question. Can you please correct the sentence and be more clear about your question. That being said, I can see ng-click="createData(modal_id, Name, VTypeID, RunAsId)" has 4 params where as in your js file $scope.createData = function (obj, data, extra) { is only able to handle 3 arguments. Please check if that's not the issue and let me know :)
    – Shashank Vivek
    Nov 14 '18 at 16:43










  • Shashank Vivek, thank you for answer. You are right, of course, but how should I fix it? I'm sorry if it's hard to understand my explanation, english is not my first language. I've added a picture, and rewrited the question.
    – Dasha Custo
    Nov 15 '18 at 11:22










  • Did my answer helped ?
    – Shashank Vivek
    Nov 20 '18 at 16:52










  • Sorry, but no =(
    – Dasha Custo
    Nov 21 '18 at 7:36










  • Sorry, but no =( when I call the function in html it nust have 4 params (with modal_id) because modal_id tell to the function what condition to take (the function is structured by "if"-blocks, and without modal_id function doesn't knoe what block to produce, so it shows log "data undefined"). Also I shouldn't put modal_id to the arguments (I've tried, it brings error). Your advice seems very logical to me, but it doesnt work. This app was created by another man, and I just trying to follow his logic, everything works, and this function working perfectly, I just need to understand this logic
    – Dasha Custo
    Nov 21 '18 at 7:51














  • 1




    Hey Dasha, I am not able to understand what's the actual question. Can you please correct the sentence and be more clear about your question. That being said, I can see ng-click="createData(modal_id, Name, VTypeID, RunAsId)" has 4 params where as in your js file $scope.createData = function (obj, data, extra) { is only able to handle 3 arguments. Please check if that's not the issue and let me know :)
    – Shashank Vivek
    Nov 14 '18 at 16:43










  • Shashank Vivek, thank you for answer. You are right, of course, but how should I fix it? I'm sorry if it's hard to understand my explanation, english is not my first language. I've added a picture, and rewrited the question.
    – Dasha Custo
    Nov 15 '18 at 11:22










  • Did my answer helped ?
    – Shashank Vivek
    Nov 20 '18 at 16:52










  • Sorry, but no =(
    – Dasha Custo
    Nov 21 '18 at 7:36










  • Sorry, but no =( when I call the function in html it nust have 4 params (with modal_id) because modal_id tell to the function what condition to take (the function is structured by "if"-blocks, and without modal_id function doesn't knoe what block to produce, so it shows log "data undefined"). Also I shouldn't put modal_id to the arguments (I've tried, it brings error). Your advice seems very logical to me, but it doesnt work. This app was created by another man, and I just trying to follow his logic, everything works, and this function working perfectly, I just need to understand this logic
    – Dasha Custo
    Nov 21 '18 at 7:51








1




1




Hey Dasha, I am not able to understand what's the actual question. Can you please correct the sentence and be more clear about your question. That being said, I can see ng-click="createData(modal_id, Name, VTypeID, RunAsId)" has 4 params where as in your js file $scope.createData = function (obj, data, extra) { is only able to handle 3 arguments. Please check if that's not the issue and let me know :)
– Shashank Vivek
Nov 14 '18 at 16:43




Hey Dasha, I am not able to understand what's the actual question. Can you please correct the sentence and be more clear about your question. That being said, I can see ng-click="createData(modal_id, Name, VTypeID, RunAsId)" has 4 params where as in your js file $scope.createData = function (obj, data, extra) { is only able to handle 3 arguments. Please check if that's not the issue and let me know :)
– Shashank Vivek
Nov 14 '18 at 16:43












Shashank Vivek, thank you for answer. You are right, of course, but how should I fix it? I'm sorry if it's hard to understand my explanation, english is not my first language. I've added a picture, and rewrited the question.
– Dasha Custo
Nov 15 '18 at 11:22




Shashank Vivek, thank you for answer. You are right, of course, but how should I fix it? I'm sorry if it's hard to understand my explanation, english is not my first language. I've added a picture, and rewrited the question.
– Dasha Custo
Nov 15 '18 at 11:22












Did my answer helped ?
– Shashank Vivek
Nov 20 '18 at 16:52




Did my answer helped ?
– Shashank Vivek
Nov 20 '18 at 16:52












Sorry, but no =(
– Dasha Custo
Nov 21 '18 at 7:36




Sorry, but no =(
– Dasha Custo
Nov 21 '18 at 7:36












Sorry, but no =( when I call the function in html it nust have 4 params (with modal_id) because modal_id tell to the function what condition to take (the function is structured by "if"-blocks, and without modal_id function doesn't knoe what block to produce, so it shows log "data undefined"). Also I shouldn't put modal_id to the arguments (I've tried, it brings error). Your advice seems very logical to me, but it doesnt work. This app was created by another man, and I just trying to follow his logic, everything works, and this function working perfectly, I just need to understand this logic
– Dasha Custo
Nov 21 '18 at 7:51




Sorry, but no =( when I call the function in html it nust have 4 params (with modal_id) because modal_id tell to the function what condition to take (the function is structured by "if"-blocks, and without modal_id function doesn't knoe what block to produce, so it shows log "data undefined"). Also I shouldn't put modal_id to the arguments (I've tried, it brings error). Your advice seems very logical to me, but it doesnt work. This app was created by another man, and I just trying to follow his logic, everything works, and this function working perfectly, I just need to understand this logic
– Dasha Custo
Nov 21 '18 at 7:51












1 Answer
1






active

oldest

votes


















0















why do it write data from input to all variables?




Because, you are assigning data to all properties



params: {name: data, VtypeID: data, RunAsID:data }



you should do,



$scope.createData = function (modal_id, name, vTypeID, runAsId) {


and then:



  if ($scope.dictFilter == 'virtualConnectors') {
$http({
method: 'GET',
url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
params: {name: name, VtypeID: vTypeID, RunAsID: runAsId } // <-- Check this line
}).then(function successCallback(response) {
Modals.close(obj)
getData();
}, function errorCallback(response) {
console.log("function createData doesn't callback");
});
return;
}


similarly, correct the params for 'accounts'.



There are several bad practices in your code as well:




  1. using ng-controller on each <tr> tag. Use it on table level

  2. Passing modal_id when it's not being used.

  3. passing name in your case data as password. It doesn't make any sense to name variable incorrectly. IF its a name, you shouldn't use password to refer it.


I will suggest you to get your code reviewed by some expert to avoid "bad coding practices" that you are following in your code.



I hope my answer will help you :)






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304525%2fhow-to-set-params-in-http-get-method-to-send-data-from-dropdown-angularjs%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    why do it write data from input to all variables?




    Because, you are assigning data to all properties



    params: {name: data, VtypeID: data, RunAsID:data }



    you should do,



    $scope.createData = function (modal_id, name, vTypeID, runAsId) {


    and then:



      if ($scope.dictFilter == 'virtualConnectors') {
    $http({
    method: 'GET',
    url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
    params: {name: name, VtypeID: vTypeID, RunAsID: runAsId } // <-- Check this line
    }).then(function successCallback(response) {
    Modals.close(obj)
    getData();
    }, function errorCallback(response) {
    console.log("function createData doesn't callback");
    });
    return;
    }


    similarly, correct the params for 'accounts'.



    There are several bad practices in your code as well:




    1. using ng-controller on each <tr> tag. Use it on table level

    2. Passing modal_id when it's not being used.

    3. passing name in your case data as password. It doesn't make any sense to name variable incorrectly. IF its a name, you shouldn't use password to refer it.


    I will suggest you to get your code reviewed by some expert to avoid "bad coding practices" that you are following in your code.



    I hope my answer will help you :)






    share|improve this answer


























      0















      why do it write data from input to all variables?




      Because, you are assigning data to all properties



      params: {name: data, VtypeID: data, RunAsID:data }



      you should do,



      $scope.createData = function (modal_id, name, vTypeID, runAsId) {


      and then:



        if ($scope.dictFilter == 'virtualConnectors') {
      $http({
      method: 'GET',
      url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
      params: {name: name, VtypeID: vTypeID, RunAsID: runAsId } // <-- Check this line
      }).then(function successCallback(response) {
      Modals.close(obj)
      getData();
      }, function errorCallback(response) {
      console.log("function createData doesn't callback");
      });
      return;
      }


      similarly, correct the params for 'accounts'.



      There are several bad practices in your code as well:




      1. using ng-controller on each <tr> tag. Use it on table level

      2. Passing modal_id when it's not being used.

      3. passing name in your case data as password. It doesn't make any sense to name variable incorrectly. IF its a name, you shouldn't use password to refer it.


      I will suggest you to get your code reviewed by some expert to avoid "bad coding practices" that you are following in your code.



      I hope my answer will help you :)






      share|improve this answer
























        0












        0








        0







        why do it write data from input to all variables?




        Because, you are assigning data to all properties



        params: {name: data, VtypeID: data, RunAsID:data }



        you should do,



        $scope.createData = function (modal_id, name, vTypeID, runAsId) {


        and then:



          if ($scope.dictFilter == 'virtualConnectors') {
        $http({
        method: 'GET',
        url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
        params: {name: name, VtypeID: vTypeID, RunAsID: runAsId } // <-- Check this line
        }).then(function successCallback(response) {
        Modals.close(obj)
        getData();
        }, function errorCallback(response) {
        console.log("function createData doesn't callback");
        });
        return;
        }


        similarly, correct the params for 'accounts'.



        There are several bad practices in your code as well:




        1. using ng-controller on each <tr> tag. Use it on table level

        2. Passing modal_id when it's not being used.

        3. passing name in your case data as password. It doesn't make any sense to name variable incorrectly. IF its a name, you shouldn't use password to refer it.


        I will suggest you to get your code reviewed by some expert to avoid "bad coding practices" that you are following in your code.



        I hope my answer will help you :)






        share|improve this answer













        why do it write data from input to all variables?




        Because, you are assigning data to all properties



        params: {name: data, VtypeID: data, RunAsID:data }



        you should do,



        $scope.createData = function (modal_id, name, vTypeID, runAsId) {


        and then:



          if ($scope.dictFilter == 'virtualConnectors') {
        $http({
        method: 'GET',
        url: appID + '/Insert_Methods.asmx/Insert_VirtualConnector',
        params: {name: name, VtypeID: vTypeID, RunAsID: runAsId } // <-- Check this line
        }).then(function successCallback(response) {
        Modals.close(obj)
        getData();
        }, function errorCallback(response) {
        console.log("function createData doesn't callback");
        });
        return;
        }


        similarly, correct the params for 'accounts'.



        There are several bad practices in your code as well:




        1. using ng-controller on each <tr> tag. Use it on table level

        2. Passing modal_id when it's not being used.

        3. passing name in your case data as password. It doesn't make any sense to name variable incorrectly. IF its a name, you shouldn't use password to refer it.


        I will suggest you to get your code reviewed by some expert to avoid "bad coding practices" that you are following in your code.



        I hope my answer will help you :)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 17 '18 at 8:12









        Shashank Vivek

        4,15232356




        4,15232356






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304525%2fhow-to-set-params-in-http-get-method-to-send-data-from-dropdown-angularjs%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            鏡平學校

            ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

            Why https connections are so slow when debugging (stepping over) in Java?