<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>http variable &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/http-variable/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Thu, 20 Aug 2015 05:33:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>http variable &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Learning AngularJS: $http</title>
		<link>https://mail.sibeeshpassion.com/learning-angularjs-http/</link>
					<comments>https://mail.sibeeshpassion.com/learning-angularjs-http/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 29 Mar 2015 20:18:58 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[$http]]></category>
		<category><![CDATA[$http in Angular JS]]></category>
		<category><![CDATA[Angular JS]]></category>
		<category><![CDATA[http variable]]></category>
		<category><![CDATA[Learning Angular JS]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1561</guid>

					<description><![CDATA[Hi all, I hope you are fine. Today we will learn about AngularJS Basic $http. If you are new to AngularJS then I suggest you read the Basics of AngularJS. Now with the assumption that you have read my previous article, we are starting. This article explains $http in Angular JS. Using the code $http is a service for reading data from web services. It uses the get (service URL) method for the process. We will see that with an example. [html] &#60;div ng-app=&#34;httpApp&#34; ng-controller=&#34;httpController&#34;&#62; &#60;ul&#62; &#60;li ng-repeat=&#34;det in details&#34;&#62;{{ det.name + &#8216;, &#8216; + det.countrycode }} &#60;/li&#62; &#60;/ul&#62; &#60;/div&#62; [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hi all, I hope you are fine. Today we will learn about AngularJS Basic $http. If you are new to AngularJS then I suggest you read the <a href="http://sibeeshpassion.com/basics-of-angularjs/" target="_blank">Basics of AngularJS</a>.</p>
<p>Now with the assumption that you have read my previous article, we are starting.</p>
<p>This article explains $http in Angular JS.</p>
<p><strong>Using the code</strong></p>
<p>$http is a service for reading data from web services. It uses the get (service URL) method for the process. We will see that with an example.<br />
[html]<br />
&lt;div ng-app=&quot;httpApp&quot; ng-controller=&quot;httpController&quot;&gt;<br />
    &lt;ul&gt;<br />
        &lt;li ng-repeat=&quot;det in details&quot;&gt;{{ det.name + &#8216;, &#8216; + det.countrycode }}<br />
&lt;/li&gt;<br />
    &lt;/ul&gt;<br />
&lt;/div&gt;<br />
[/html]</p>
<p>In the preceding code, we have an Angular app httpApp and a controller httpController. Now we need to create our controller part, right?<br />
[js]<br />
&lt; script &gt;<br />
var app = angular.module(&#8216;httpApp&#8217;, []);<br />
app.controller(&#8216;httpController&#8217;, function($scope, $http) {<br />
    $http.get(&quot;http://api.geonames.org/citiesJSON?north=44.1&amp;south=-9.9&amp;east=- 22.4&amp;west=55.2&amp;lang=de&amp;username=demo&quot;)<br />
        .success(function(response) {<br />
        $scope.details = response.geonames;<br />
    });<br />
}); &lt; /script&gt;<br />
[/js]</p>
<p>In the preceding code we are using the $http.get() method of Angular. In the URL part we have given a sample web service URL of geo data. You can get these free web services here.</p>
<p>So in the success part we are returning the response of the web service. </p>
<p>Now if you write the response.geonames in the success in the browser console as follows, you will get the array as shown below.</p>
<p>console.log(response.geonames);  </p>
<p><div id="attachment_9941" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/Learning-AngularJS-http1.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-9941" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/Learning-AngularJS-http1-1024x516.png" alt="Learning AngularJS http" width="634" height="319" class="size-large wp-image-9941" srcset="/wp-content/uploads/2015/03/Learning-AngularJS-http1.png 1024w, /wp-content/uploads/2015/03/Learning-AngularJS-http1-300x151.png 300w, /wp-content/uploads/2015/03/Learning-AngularJS-http1-768x387.png 768w, /wp-content/uploads/2015/03/Learning-AngularJS-http1-400x202.png 400w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-9941" class="wp-caption-text">Learning AngularJS http</p></div><br />
Once it is returned we are showing the response data to the UI using the repeat directive.</p>
<p>So that is all.</p>
<p><strong>Output</strong></p>
<div id="attachment_9951" style="width: 449px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/Learning-AngularJS-http2.png"><img decoding="async" aria-describedby="caption-attachment-9951" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/Learning-AngularJS-http2.png" alt="Learning AngularJS http" width="439" height="261" class="size-full wp-image-9951" srcset="/wp-content/uploads/2015/03/Learning-AngularJS-http2.png 439w, /wp-content/uploads/2015/03/Learning-AngularJS-http2-300x178.png 300w, /wp-content/uploads/2015/03/Learning-AngularJS-http2-400x238.png 400w" sizes="(max-width: 439px) 100vw, 439px" /></a><p id="caption-attachment-9951" class="wp-caption-text">Learning AngularJS http</p></div>
<p>Now apply the CSS</p>
<p>Add the following CSS to your page.<br />
[css]<br />
&lt; style &gt; li {<br />
    border: 1px solid#ccc;<br />
    border &#8211; right: none;<br />
    border &#8211; left: none;<br />
    padding: 2px;<br />
    text &#8211; align: center;<br />
    list &#8211; style: none;<br />
} &lt; /style&gt;<br />
[/css]</p>
<p>Once you add the CSS you will get output as follows.</p>
<div id="attachment_9961" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/Learning-AngularJS-http3.png"><img decoding="async" aria-describedby="caption-attachment-9961" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/Learning-AngularJS-http3-1024x229.png" alt="Learning AngularJS http" width="634" height="142" class="size-large wp-image-9961" srcset="/wp-content/uploads/2015/03/Learning-AngularJS-http3.png 1024w, /wp-content/uploads/2015/03/Learning-AngularJS-http3-300x67.png 300w, /wp-content/uploads/2015/03/Learning-AngularJS-http3-768x172.png 768w, /wp-content/uploads/2015/03/Learning-AngularJS-http3-400x89.png 400w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-9961" class="wp-caption-text">Learning AngularJS http</p></div>
<p>Cool. We did it.</p>
<p><strong>Complete HTML</strong><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html<br />
    xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
    &lt;head&gt;<br />
        &lt;title&gt;Angular $http &#8211; sibeeshpassion &lt;/title&gt;<br />
        &lt;style&gt;<br />
         li {<br />
            border: 1px solid #ccc;<br />
            border-right: none;<br />
            border-left: none;<br />
            padding: 2px;<br />
            text-align: center;<br />
            list-style:none;<br />
          }<br />
         &lt;/style&gt;<br />
        &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;/head&gt;<br />
    &lt;body&gt;<br />
        &lt;div ng-app=&quot;httpApp&quot; ng-controller=&quot;httpController&quot;&gt;<br />
            &lt;ul&gt;<br />
                &lt;li ng-repeat=&quot;det in details&quot;&gt;{{ det.name + &#8216;, &#8216; + det.countrycode }} &lt;/li&gt;<br />
            &lt;/ul&gt;<br />
        &lt;/div&gt;<br />
        &lt;script&gt;<br />
            var app = angular.module(&#8216;httpApp&#8217;, []);<br />
            app.controller(&#8216;httpController&#8217;, function ($scope, $http) {<br />
            $http.get(&quot;http://api.geonames.org/citiesJSON?north=44.1&amp;south=-9.9&amp;east=-22.4&amp;west=55.2&amp;lang=de&amp;username=sibeeshvenu&quot;)<br />
            .success(function (response) {<br />
               $scope.details = response.geonames;<br />
               console.log(response.geonames);<br />
               });<br />
         });<br />
         &lt;/script&gt;<br />
    &lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>Now that is all for the day, I will return with another set of items in Angular JS soon. I hope you liked this article. Please provide your valuable suggestions.</p>
<p>Kindest Regards<br />
Sibeesh venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/learning-angularjs-http/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
