ASPForums.Net RSS Feed additions to the content that appears on ASPForums.Net(c) 2018 All rights reserved.What is Dependency Injection and how to use Dependency Injection in Controller of AngularJs in ASP.Net<p>hello sir&nbsp;</p> <p>i am new in angular js and want to know about dependency injection</p> <p>any one tell me the esay way what is dependency and why it is so usefull&nbsp;</p> <p>like below example we create scop and http as a injector i think</p> <pre class="brush: js"> countryApp.controller(&#39;CountryCtrl&#39;, [&#39;$scope&#39;, &#39;$http&#39;, function (scope, http){ http.get(&#39;countries.json&#39;).success(function(data) { scope.countries = data; });</pre> <p>&nbsp;</p>, 12 Jun 2017 02:20:33 GMTUpload files and form data in same request using AngularJS in ASP.Net<p>Does anybody know how i can upload image and post form data at the same time with AngularJS and web api. Its urgent!!!</p>, 26 Feb 2018 02:44:45 GMTTutorials for AngularJS 2 / 4 / 5<p>Hi,</p> <p>Is there any tutorials for Angular 2/4/5 for learning Angular step by step.</p> <p>&nbsp;</p>, 14 Dec 2017 05:02:34 GMTShow Hide HTML DIV using AngularJS<p>I wonder how&nbsp; it work?</p> <pre class="brush: html">//If DIV is visible it will be hidden and vice versa. $scope.IsVisible = value == &#34;Y&#34;;</pre> <p>DIV is visible it will be hidden and vice versa</p>, 20 Feb 2018 01:26:02 GMTPass multiple parameters from AngularJS to ASP.Net MVC controller<div class="edit-comment-hide"> <div class="comment-body markdown-body markdown-format js-comment-body"> <p>In my scenario I wanna pass two parameters (Array,string) to API controller POST method, How can I determine resource and setCode for passing two parameter?</p> </div> </div> <pre class="brush: js"> Resource: app.factory(&#34;EthnicCodeResource&#34;, [&#39;$resource&#39;, function ($resource) { return { Codes: $resource(&#39;api/Code/:collection&#39;, { collection: &#39;@collection&#39; }, { postCollection: { method: &#39;POST&#39;, isArray: true } }), Effects: $resource(&#39;api/Effects:reviewSetCode&#39;, { reviewSetCode: &#39;@reviewSetCode&#39; }, { setCode: { method: &#39;POST&#39;, isArray: true } }), HCodes: $resource(&#39;api/HCodes&#39;) } + + Save: EthnicCodeResource.Effects.setCode($rootScope.myData).$promise.then (function() { }); + API Controller: [HttpPost] public void Post(List reviewSetCode) { // + } + +In my scenario I wanna pass two parameters (Array,string)to API controller POST method, +like, [HttpPost] public void Post(List reviewSetCode, string act) { // + }. + </pre> <p>In my scenario I wanna pass two parameters (Array,string) to API controller POST method, How can I determine resource and setCode for passing two parameter?</p>, 12 May 2015 03:53:08 GMTSave image path to Database using AngularJS in ASP.Net<p>====&gt;the webservice</p> <pre class="brush: csharp">[WebMethod] public string insert(string city,string country,string flag) { try { using(SqlConnection conn =new SqlConnection(clsMain.sqlconnstring)) { conn.Open(); SqlCommand cmd = new SqlCommand(&#34;spInsertUploadPicture&#34;, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue(&#34;@city&#34;, city); cmd.Parameters.AddWithValue(&#34;@country&#34;,country); cmd.Parameters.AddWithValue(&#34;@imgpath&#34;, string.Format(&#34;../imageUploads/{0}&#34;,flag)); cmd.ExecuteNonQuery(); return &#34;Record Uploaded Successfully&#34;; } } catch (Exception) { throw; } }</pre> <p>===&gt;&gt;&gt;&gt; the controller</p> <pre class="brush: js">.directive(&#34;fileInput&#34;,function($parse){ return { restrict: &#34;A&#34;, link: function (scope,elem,attrs) { elem.bind(&#34;change&#34;, function () { $parse(attrs.fileInput).assign(scope, elem[0].files); scope.$apply(); }); } } }) .controller(&#34;imageUploadPracticeController&#34;, function ($scope,$http,$timeout) { var vm = this; vm.loading = false; vm.msg = false; vm.error = false; // read(); vm.imageUpload = function (event) { var files =;//filelist object var file = files[files.length - 1]; vm.file = file; var reader = new FileReader(); reader.onload = vm.imageIsLoaded; reader.readAsDataURL(file); } vm.imageIsLoaded = function (e) { $scope.$apply(function () { vm.step =; }); } vm.btnUpload = function () { vm.loading = true; var request = $http({ url: &#39;../services/svImageUpload.asmx/insert&#39;, method: &#39;POST&#39;, data: { city: vm.City, country: vm.Country, flag: }, //transformRequest:angular.identity, headers: {&#39;content-type&#39;:undefined} }); request.then(function (response) { read(); vm.loading = false; vm.error = false; vm.hurray =; vm.msg = true; }, function (error) { vm.error = true; vm.error =; vm.loading = false; vm.msg = false; }); //console.log(vm.City + &#39; &#39; + vm.Country + &#39; &#39; +; } var read = function () { var request = $http(&#34;../services/svImageUpload.asmx/GetAllFiles&#34;) .then(function (response) { vm.imgUploads =; }); } vm.closeSuccessMsg = function () { vm.loading = false; vm.msg = false; vm.error = false; $(&#34;#txtCity&#34;).val(&#39;&#39;); $(&#34;#txtCountry&#34;).val(&#39;&#39;); } vm.closeErrorMsg = function () { vm.loading = false; vm.msg = false; vm.error = false; $(&#34;#txtCity&#34;).val(&#39;&#39;); $(&#34;#txtCountry&#34;).val(&#39;&#39;); } });</pre>, 26 May 2017 11:39:14 GMTRetrieve and display data from Database in TextBox on Button click using AngularJS in ASP.Net<p>how to retrieve data from database to textbox in angularjs</p> <p>on button click event.</p>, 03 Feb 2018 03:54:59 GMTPopulate HTML Table with DropDownList (HTML Select) using AngularJS<p>i have table which contains&nbsp; 5 fruits information</p> <p>in each row fruits name and a drop down is there</p> <p>values for drop down are "Select","Yes","No" </p> <p>now i have to display all the 5 fruits information below the table .</p> <p>need to display in table form with the selected dropdown values.</p> <p>Please give me idea in angularJS</p>, 19 Jan 2018 05:17:17 GMTMerge Table Rows for same column value using AngularJS in ASP.Net<p>I want to display record on my html page like this.</p> <table> <tbody> <tr> <td width="399"> <p>Invoice No 1</p> </td> <td width="399"> <p>Product 1</p> </td> </tr> <tr> <td width="399"> <p>&nbsp;</p> </td> <td width="399"> <p>Product 2</p> </td> </tr> <tr> <td width="399"> <p>&nbsp;</p> </td> <td width="399"> <p>Product 3</p> </td> </tr> <tr> <td width="399"> <p>Invoice No 2</p> </td> <td width="399"> <p>Product 1</p> </td> </tr> <tr> <td width="399"> <p>Invoice No 3</p> </td> <td width="399"> <p>Product 1</p> </td> </tr> <tr> <td width="399"> <p>Invoice No 4</p> </td> <td width="399"> <p>Product 1</p> </td> </tr> <tr> <td width="399"> <p>&nbsp;</p> </td> <td width="399"> <p>Product 2</p> </td> </tr> <tr> <td width="399"> <p>&nbsp;</p> </td> <td width="399"> <p>Product 3</p> </td> </tr> </tbody> </table> <p>&nbsp;I have this information in a list here's my code</p> <p>&nbsp;</p> <pre class="brush: csharp">static void Main(string[] args) { List&lt;Program&gt; listdata = new List&lt;Program&gt;(); listdata.Add(new Program { InvoiceNo=001, Product=&#34;Product1&#34;}); listdata.Add(new Program { InvoiceNo = 001, Product = &#34;Product2&#34; }); listdata.Add(new Program { InvoiceNo = 001, Product = &#34;Product3&#34; }); listdata.Add(new Program { InvoiceNo = 001, Product = &#34;Product4&#34; }); listdata.Add(new Program { InvoiceNo = 001, Product = &#34;Product5&#34; }); listdata.Add(new Program { InvoiceNo = 002, Product = &#34;Product1&#34; }); listdata.Add(new Program { InvoiceNo = 003, Product = &#34;Product1&#34; }); listdata.Add(new Program { InvoiceNo = 004, Product = &#34;Product1&#34; }); listdata.Add(new Program { InvoiceNo = 004, Product = &#34;Product2&#34; }); listdata.Add(new Program { InvoiceNo = 004, Product = &#34;Product3&#34; }); foreach (var item in listdata) { Console.WriteLine(String.Format(&#34;Invoice No : {0} Product : {1}&#34;,item.InvoiceNo,item.Product)); } Console.ReadLine(); }</pre> <p>Had used foreach for example purpose,have to display data on a html page in ng-repeat in angular js am not able to arrange the required list in this format as displayed above.</p>, 09 Apr 2017 02:08:19 GMTHow to use custom scope variable within ng-repeat using angularjs<p>We have to use custom scope varibale within ng-repeat using angularjs, but it will return last value to all</p> <pre class="brush: html">&lt;div ng-repeat=&#34;pro in UserProduct&#34;&gt; {{discountvalue}} &lt;/div&gt;</pre> <p>&nbsp;</p> <pre class="brush: js">&lt;script&gt; $http.get(&#39;/api/Product/ListOnlyProductOrderFeatured/&#39;, { params: {} }).success(function (data) { $scope.UserProduct = data; for (var i = 0; i &lt; $scope.UserProduct.length; i++) { $scope.generalprice = $scope.UserProduct[i].ec_shop_product_price; $scope.discountprice = $scope.UserProduct[i].ec_shop_product_discount; $scope.discountvalue = $scope.generalprice - $scope.discountprice; } }) &lt;/script&gt;</pre> <p>Please anyone explain how to do ASAP</p>, 16 Mar 2018 02:48:37 GMTHow to Print a page or DIV using AngularJS<table style="height: 132px;" width="250"> <tbody> <tr> <td>Product</td> <td>Date</td> <td>Time</td> </tr> <tr> <td>juice</td> <td>2015-02-25</td> <td>14:00:00</td> </tr> <tr> <td>cheese</td> <td>2015-02-25</td> <td>07:00:00</td> </tr> <tr> <td>CHIPS</td> <td>2015-02-25</td> <td>16:00:00</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </tbody> </table> <p>i have the above table that is displayed on a web page. i want to have a button that when its clicked it must call a function to print out just the table. how do i achieve this? do i have to send this data to a text file or something first? but i need to do it in angular js.</p> <p>i have a function that displays the above table as follows&nbsp;</p> <pre class="brush: js">function Report($http) { var self = this; self.$http = $http; self.GetReport = function () { var result = Ajax.Get(self.$http, { url: GetReportjson, success: function (data) { self.DisplayReport = data; } }).error(function () { alert(&#34; error!&#34;); }); } </pre> <p>&nbsp;</p>, 25 Feb 2015 02:09:22 GMTHow to pass parameters from Angularjs to code behind<p>How to pass parameters from Angularjs to code behind.</p> <p>here is code</p> <p>&nbsp;$scope.submit = function (item) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $'Default.aspx/getstring',{data: item})<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .success(function (data) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(status.d);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; })<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .error(function (data) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $scope.status = status;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>i want to pass parameters 'item' to&nbsp;getstring() web method.</p> <p>can anyone help me and iam new to angularjs</p> <p>Thanks in advance</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p>, 07 Feb 2016 23:51:11 GMTHow to implement Autocomplete TextBox using AngularJS in ASP.Net<p>Previously I was using jquery for autocomplete &nbsp;but it seems slow that angular js, I want to know how to use angular js .</p> <p>below my jquery code</p> <pre class="brush: js"> $(&#34;#HTL&#34;).autocomplete({ source: function (request, response) { var customer = new Array(); $.ajax({ url: &#34;/Home/expedia&#34;, data: &#34;{ &#39;Text&#39;: &#39;&#34; + request.term + &#34;&#39; }&#34;, dataType: &#34;json&#34;, type: &#34;POST&#34;, contentType: &#34;application/json; charset=utf-8&#34;, success: function (data) { console.log(&#39;auto&#39;); response($.map(data, function (item, id) { return { label: item.region, val: item.region } })) }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); }, focus: function (event, ui) { // prevent autocomplete from updating the textbox event.preventDefault(); // manually update the textbox $(this).val(ui.item.label); $(&#39;#HTLID&#39;).val(ui.item.val); }, minLength: 2, select: function (event, ui) { $(&#39;#HTL&#39;).val(ui.item.label); $(&#39;#HTLID&#39;).val(ui.item.val); return false; } }).data(&#34;autocomplete&#34;)._renderItem = function (ul, item) { return $(&#34;&lt;li id=&#34; + item.val + &#34;&gt;&lt;/li&gt;&#34;) .data(&#34;item.autocomplete&#34;, item) .append(&#34;&lt;a&gt;&lt;p&gt;&#34; + item.label + &#34;&lt;/p&gt;&lt;/a&gt;&#34;).appendTo(ul); };</pre> <p>&nbsp;</p>, 24 Nov 2014 03:10:38 GMTHow to hide parameters from url using AngularJS in ASP.Net<p>how to hide id in url&nbsp;in angular js&nbsp;</p> <p>like my url&nbsp;&nbsp;<a href="http://localhost:6790/#/sectionkeywords/1">http://localhost:6790/#/sectionkeywords/1</a></p> <p>and i need to hide 1 which is id of product selection&nbsp;</p> <p>so how to hide this id ?</p>, 21 Jul 2017 02:34:27 GMTHow to download files using AngularJS in ASP.Net<p>guys pls can anyone show me how to download files or images using angularjs</p>, 29 May 2017 02:55:23 GMTGet url path without querystring using AngularJS in ASP.Net<p>Hi,</p> <p>When try get url&nbsp;path (home.html or page.html) with</p> <p><strong>var url = $location.path();</strong></p> <p>on my current path in browser add this&nbsp;<strong>#/home.html</strong></p> <p>and url look this:&nbsp;<a href="http://localhost:12241/home.html#/home.html">http://localhost:12241/home.html#/home.html</a></p> <p>i want only&nbsp;<a href="http://localhost:12241/home.html#/home.html">http://localhost:12241/home.html</a></p> <p>What is this, how solve this?</p>, 15 Jun 2016 06:35:19 GMTCreate tic tac toe game using AngularJS in ASP.Net<p>Hi can you help me how to create tic tac toe game in angularjs any reference</p>, 22 May 2017 02:24:59 GMTCreate custom Directives in AngularJS in ASP.Net<p>custom directive examples</p>, 18 Apr 2017 01:50:49 GMTConnectionString to connect Database in .NetCore with AngularJS in ASP.Net<p>How to connect database in .netcore with angular4 bootstrap.Means about connectivity, connectionstring</p>, 27 Dec 2017 00:37:17 GMTAuthentication using AngularJS $routeProvider<p>how to do authentication using angularjs ,only using $routeProvider</p>, 18 Sep 2015 03:46:46 GMT