Managing multiple requests with RxJS can be done in multiple ways. Use Http Client In Game Service. What we would like to achieve in this section is a simple way to exempt some request from going through a http interceptor. An in-memory web api for Angular demos and tests that emulates CRUD operations over a RESTy API. We’ll learn to create and consume RESTful APIs in Angular 8 project. Other parts that are responsible for http calls (Http, XhrConnection, XhrBackend) are used as is, which means that angular-progress-http will automatically receive fixes and new features from newer versions of angular/http. This class is based on the RequestInit description in the Fetch Spec. Responsive image using HTML-5 srcset. Fetching numerous asynchronous requests and managing them can be tricky but with the Angular's Http service and a little help from the included RxJS library, it can be accomplished in just a few of lines of code. AngularJS will consider all properties starting with a $ as private, and thus exclude these from the string. When we have multiple requests in-flight at the same time we must account for cases where they come back in unexpected order. Angular is a platform for building mobile and desktop web applications. 3, which enables direct access to the JSON response when subscribing to the Observable from the HTTP request. Since providers should generally be registered at the top-most module and the HttpClient service is usually used in many places throughout the app, it's acceptable to register it either in the root AppModule or the SharedModule of your application when it gets bootstrapped. all, making your project's code cleaner and more testable. In this post I am going to show you how we can upload multiple files with progress bar. Build amazing mobile, web, and desktop apps all with one shared code base and open web standards. Modifying Requests. A collection of properties that represent the presence of different browser features or bugs. config the object used to generate the request. Ben Nadel takes a look at using the $http service in AngularJS to make AJAX (Asynchronous JavaScript and XML) requests. We will then introduce some of the Angular Testing utilities such as the Angular TestBed, which we will be using to test a couple of simple Angular services. Here, we will review a few of the concepts and eventually see how to run multiple concurrent HTTP requests, with the callbacks running only after all of them have completed. Having requests return observables is great because we will be able to use RxJS's operators to get the returned streams behave the way we like. Angular Development with TypeScript, Second Edition teaches you how to build web applications with Angular and TypeScript. Multiple dependencies were needed during the module setup and the faked connections were only available through an Observable object. This subscription stays open until you unsubscribe from it, and you can use this subscription to trigger multiple requests. This also allows you to use your own custom domain with an HTTP function. Below is the approach I took, with some justifications for the decisions I took. Angular is a complete rewrite from the same team that built AngularJS. Angular 2 Http testing multiple connections. Making HTTP requests is a vital operation in the life of most front-end applications. It is making requests to server side Rest APIs, which is in Java, Spring boot. They followed the same guidelines, only syntax changed, but writing the tests remained easy. You can add your comment about this article using the form below. If we use ctrl+c to cancel the currently running node server and re-run our server using node index. Multiple HTTP Requests in Angular RxJS can get confusing sometimes and it may not be obvious at first how to do certain things. single-spa-angular is a library for creating Angular microfrontends. Safe image requests in angular Brecht Billiet 24 Oct 2017 on Angular. Conclusion. A set of selected questions and answers of Angular 2 that helps you to clarify the concepts of Angular 2 Reading interview questions is one of the great ways to learn and brush up the left-over concepts even if you are not preparing for the interview. Angular 6 Http Request Methods Tutorial. Sets the HTTP method used for the request. SPA’s are on the rise but there are a lot of. If you start using Angular you will probably encounter observables when setting up your HTTP requests. It was a Tuesday. So in the middle of last year I was working on building a site in AngularJS where I had two API endpoints to connect to and while neither API calls required the results of the other I needed to be able to process the returned data for both at the same time. 1 introduced one important new feature: the new HTTP client. I assume you have read my Simple Hello Angular Tutorial, That let you know basics of angular application. If there are multiple GET requests for the same URL that should be cached using the same cache, but the cache is not populated yet, only one request to the server will be made and the remaining requests will be. The core of a single page application in Angular (or any modern front-end framework) these days is going to be a Node. 10 and Webpack 4. In the Angular Service Dependency Injection tutorial, we had hard-coded the games data into the game. Re: My task is to download multiple files asynchronously using c# and Angular JS? Nov 10, 2015 11:06 AM | bruce (sqlwork. We will learn how how to make HTTP requests using. Especially for apps which intend to run on multiple devices. It performs a request using HTTP POST method. How to do HTTP Requests in Parallel, and combine the Result. It is vastly different from the AngularJS implementation, if you're curious I wrote about these differences here. It is making requests to server side Rest APIs, which is in Java, Spring boot. In this post, I will talk about how to make these changes in Angular. The HttpClientModule, which debuted in Angular 4. One way of doing HTTP requests in parallel is to use the RxJs forkjoin operator: In this example, we are taking HTTP GET observables and combining them to create a new observable. One of the most used modules is the forkJoin which can join multiple requests to the REST API synchronously, so there's no need to call REST API endpoint one by one. parent request. Other than this, our AngularJS training covers AJAX, scopes, modules, views, etc. The request object's clone method comes-in handy to do just that. Just like in the case of GET request, we can also use the Angular HTTP Client to do all the other available HTTP methods, namely the methods typically used for data modification such as PUT. An Example: Automatically Adding CSRF Tokens To demonstrate a useful task for interceptors, let's use the request property to automatically add a csrf token to every request made to the domain test-routes. The previous post, We had introduced how to set up an Angular 4 App with SpringBootSuite. Then, Use HttpClient. Angular applications heavily rely on RxJS Observables. ng g service api. There are multiple ways to handle multiple requests; they can be sequential or in parallel. Today I learned how to combine multiple HTTP requests in Angular using Observable. Angular http POST pass Multiple Parameters PHP MySQLi,angular 6 http post example with parameters,angular 6 post form data to php,how to use. Now, we can remove that data and update the service to make an HTTP request to a web server to fetch the data. Ionic is the app platform for web developers. Making a call to the server using the Angular HttpClient. HttpClient also gives us advanced functionality like the ability to listen for progress events and interceptors to monitor or modify requests or responses. data a string, or an object, carrying the response from the server. There will be an option either to select files from local PC or drag and drop the file from PC to browser. Client-side development. Angular 6 Http Request Methods Tutorial. We are going to continue making Angular smaller and faster, and we're going to evolve capabilities such as @angular/http, @angular/service-worker, and @angular/language-service out of experimental. HTTP interceptors are useful for things like caching responses, modifying HTTP headers, and logging information. NET Web API and C#. Under the covers it uses XMLHttpRequest, which is what we would use if using vanilla JavaScript. Angular 2 provides a new pattern for running asynchronous requests, called Observables. Promises are a core feature of AngularJS - whether you understand them or not, if you use AngularJS you've almost certainly been using them for a while. Just like in the case of GET request, we can also use the Angular HTTP Client to do all the other available HTTP methods, namely the methods typically used for data modification such as PUT. AngularJS is so hot right now, and it has been holding a stable position among the most popular development tools for a few years. The HttpInterceptor interface allows you to modify all incoming/outgoing HTTP requests in your Angular app. Net Web API 2. JSONP calls. But good examples are far and few between There are many “hello world” and “Todo list” applications, but few real software engineering questions are left unanswered. This way the bearer token has not be added to each request separately while doing Ajax request e. To make this process easier Angular provides an HttpInterceptor class that you can subclass and add custom behavior to for each HTTP request that is sent through the HttpClient. Get method to send an HTTP Request and Subscribe to the response Asynchronously. Fetching numerous asynchronous requests and managing them can be tricky but with the Angular's Http service and a little help from the included RxJS library, it can be accomplished in just a few of lines of code. There will be an option either to select files from local PC or drag and drop the file from PC to browser. The previous post, We had introduced how to set up an Angular 4 App with SpringBootSuite. The request object's clone method comes-in handy to do just that. This button, when clicked will call a function in an angular controller in the scripts. An Introduction to Component Routing with Angular Router This is part 4 of the SitePoint Angular 2+ Tutorial on how to create a CRUD App with the Angular CLI. The output of the above code snippet, looks like this Output. See the difference when you do jQuey. It uses the RxJS library to handle asynchronous requests and provides many options to perform the HTTP requests. I had a similar problem recently so I'm going to post my answer also: In your case you only have two calculations and it seems to be the case this number is not mutable. The HttpClient is a separate model in Angular and is available under the @angular/common/http package. This way the bearer token has not be added to each request separately while doing Ajax request e. The http service is a core Angular service that allows us to make HTTP requests from our angular code. The demand for high quality JavaScript front end engineers is very high. There will be an option either to select files from local PC or drag and drop the file from PC to browser. I recently discovered that our Angular app was making multiple HTTP requests unintentionally to the same REST API endpoint. 1 tried to fix this with pipelining, but it didn't completely address the problem (a large or slow response can still block others behind it). Years passed and Angular 2 came out, completely rewritten from the ground up. In this post we will show you Angular 6 HttpClient Tutorial, hear for The new Angular HttpClient API we will give you demo and example for implement. Use Http Client In Game Service. A set of selected questions and answers of Angular 2 that helps you to clarify the concepts of Angular 2 Reading interview questions is one of the great ways to learn and brush up the left-over concepts even if you are not preparing for the interview. js CORS: Get, Post, Put and Delete by Thibault - December 11, 2014 I’ve received requests to talk about PUT and DELETE calls on my article about CORS with Angular. Recently one of my Angular projects had a requirement to have multiple instances of websites hosted on the same domain with different base URLs. Observables in Angular. I added the cache, which can be configured for individual resource/http requests, all you need to do is pass in a cache config object as well in addition to the config for resource/http. You will build an AngularJS client that consumes a Spring-based RESTful web service. But it doesn't do everything you might expect. Thông thường để lấy data, với mỗi Url ta sẽ gửi một request, nhưng nếu dữ liệu nằm trong hai sheet khác nhau, ví dụ một sheet chứa thông tin thời tiết cho từng ngày (weather), sheet còn lại phân loại các kiểu thời tiết (types). When you subscribe to a cold observable we are creating a brand new stream every time. AngularJS is about architecture of applications, not augmenting HTML pages. Sometimes various data is gathered from multiple sources in a single request and data must be displayed only when complete data successfully arrives on the webpage from all sources. One common scenario is to wait for a number of requests to finish before continuing. Http Get API Observable code example (Angular 4, Angular 2) HttpClient Get API Observable code example (Angular 5) Sample interview questions; Http Get API Observable code example (Angular 4, Angular 2) The following code represents the usage of Observable with Http Get API. In the most abstract way, AngularJS lets us use JSON data as a model in the controller. The main purpose is to use one Loading spinner process for multiple RESTful API requests of the Angular 8 Web Application. Now we have two requests in-flight. HTTP interceptors are useful for things like caching responses, modifying HTTP headers, and logging information. An Agent is responsible for managing connection persistence and reuse for HTTP clients. js, we can see the terminal output “Request made to /space/” every time we refresh the Angular page since the requests are now going to the Node server. It turned out that way naturally. To make a request using the Angular HttpClient, we have to run our code inside an Angular app. In this article we are going to discuss about setting a common headers for all http calls using angular interceptor concept. If you start using Angular you will probably encounter observables when setting up your HTTP requests. Angular Interceptors play an important role to control and manipulate HTTP calls behavior which we do to get remote data from the server. In this article, I'll cover the new features in Angular 5 and several other changes and deprecations. Net Web API 2. If you inspect the request send, you can see it in the payload: If you want to have the object we currently had in the body as POST parameters in the URL, you can easily change the call to:. If you are already with Angular, then what we have covered will likely feel like pretty familiar territory. See Overriding the Default Transformations; transformResponse – {function(data, headersGetter, status)|Array. Creates a request options object to be optionally provided when instantiating a Request. Step by step tutorial to learn how set headers for every request in Angular using HttpInterceptor. com) | LINK each file download will be a separate server request. That one not only ensures that no real http requests are performed, it also provides APIs to subscribe to opened connections and send mock responses. Angular 5 was announced to the. The "post()" method of the HttpClient object in Angular 4 allows you to send data to a REST API, which accepts http requests, such as Web API. Request instances are typically created by higher-level classes, like Http and Jsonp, but it may occasionally be useful to explicitly create Request instances. 0, AngularJS 2. Questions: Can anyone help me with testing Http requests in Angular 2. So, I required to get the data once from the server, and everytime I am getting the data with that defined service. Angular 5: Making API calls with the HttpClient service By Keith Dechant , Software Architect, November 27, 2017 The same techniques will work with Angular 6 as long as you use the rxjs-compat Node package. Angular 7 got released this year in October with multiple new features such as CLI Prompts, Virtual Scroll, Drag and Drop, Angular Budgets and many more. For example, you can use an interceptor to add authorization token before passing the HTTP request or cache the HTTP response. Read more about how to perform Dependent request in angular here : Angular Dependent Request ; Parallel Request. While building large front end apps with these technologies we quickly will need to learn how to manage subscribing to multiple Observables in our components. data a string, or an object, carrying the response from the server. all, making your project's code cleaner and more testable. In AngularJS, multiple HTTP requests can be coordinated with $q. Angular is a platform for building mobile and desktop web applications. Since we’d rather not do round-trips we don’t need to to save on server resources caching is our go-to solution. If you are already with Angular, then what we have covered will likely feel like pretty familiar territory. We will put the multiple HTTP or RESTful API request in the Angular 8 Service. Angular Structural framework for dynamic web apps + DataTables jQuery plug-in for complex HTML tables. Find more Angular tutorials on Roufid. Request instances are typically created by higher-level classes, like Http and Jsonp, but it may occasionally be useful to explicitly create Request instances. The old API is still available in @angular/http in Angular 6, but will be removed in next versions, for easing the migration process of existing Angular 4+ applications. Waiting for the first Ajax request to complete and then issue the second request is time consuming. my-app is the name of the folder for your application. In the following example, forkJoin is used to call two methods that return Observables. How to set HTTP headers in Karate? Karate is an API testing tool with a very comprehensive and easy to understand DSL. Before we get to the complications, let’s look at some easy code. Below is the approach I took, with some justifications for the decisions I took. headers a function to use to get header information. Angular 2 Tutorial: Making HTTP requests is a vital operation in the life of most front-end applications. Although we could have easily launched those HTTP requests from within the controller itself, it is a good idea to use providers to handle the heavy lifting in the application - especially as the application starts to become more complex. A Computer Science portal for geeks. For example I was using the http success/error/finally construction but proved not to work with Angular's Bootstrap typeahead. Blog Coding Salaries in 2019: Updating. com Free Programming Books Disclaimer This is an uno cial free book created for educational purposes and is. Access the current request and set the request header within these events. I wanted to load the data from two Google Sheets and access the data in the same function. AngularJS is what HTML would have been, had it been designed for building web-apps. In this post, we will learn about Angular 6 Http Get Example Tutorial From Scratch with an example. AngularJS Promise is one of my favorite features of AngularJS. Since those function calls are asynchronous, the requests in the code initially written are already sent asynchronously. The transform. In this article, I am going to explain to you how to post data using angular 2 Http Post request , the example which I am going to take out here is submit a comment to the article, for this, I am going to build a separate comments component using JSON placeholder which is a […]. This method is preferred when you are working with the data which is more secure or you are sending large data. Next, you will discover how to modify HTTP requests and responses with interceptors and create a client-side cache. Being a part of this best Angular course training institute, you can easily develop the rich interactive application that runs on multiple platforms. Browse other questions tagged http typescript angular-2+ or ask your own question. Step by step tutorial to learn how set headers for every request in Angular using HttpInterceptor. RxJS Observables, compared to the old Promises in Angular 1, seem to be more complicated to understand, but they are far more flexible. Send request #1, send request #2, send request #3. Angular has its own HTTP module that works with Angular apps. Safe image requests in angular Brecht Billiet 24 Oct 2017 on Angular. Partiview (PC-VirDir) Peter Teuben, Stuart Levy 1 December. In the Angular Service Dependency Injection tutorial, we had hard-coded the games data into the game. Docker is an open platform for developing, shipping, and running applications. Recently one of my Angular projects had a requirement to have multiple instances of websites hosted on the same domain with different base URLs. 1 200 (I'm testing on a local server). In this tutorial, we like to show you how to use AngularJS Upload Multiple Files to ASP. Feel free to send a message and I will get back to you shortly. In this article we are going to discuss about setting a common headers for all http calls using angular interceptor concept. Angular 5 was announced to the. After all, your data has to be served from somewhere But don't worry, setting up a server is easier than you might think. Angularjs Http Post Method : Angularjs Http Post is used to perform post request. If we dig into the ngResource code - such a requirement is impossible, due to how the simple the implementation is (much to the Angular team’s credit). I would love to get in touch and talk about your next project. It is making requests to server side Rest APIs, which is in Java, Spring boot. The Basic Authentication Interceptor intercepts http requests from the application to add basic authentication credentials to the Authorization header if the user is logged in. One way of doing HTTP requests in parallel is to use the RxJs forkjoin operator: In this example, we are taking HTTP GET observables and combining them to create a new observable. There are cases when you'd like to let some code run, but if it takes too much time you'd like to stop it. u/nehalist. Connecting HTTP Functions to Firebase Hosting. In most cases, those HTTP requests work well and return the desired result. Let's consider that we have multiple HTTP requests to get the master date to load different web controls. If you set this to an object, AngularJS will serialize it to the JSON format. Crossposted by. Other parts that are responsible for http calls (Http, XhrConnection, XhrBackend) are used as is, which means that angular-progress-http will automatically receive fixes and new features from newer versions of angular/http. js AngularJS: AngularJS The following is a custom example and tutorial on how to setup a simple login page using Angular 6 and Basic HTTP authentication. Angular Development with TypeScript, Second Edition teaches you how to build web applications with Angular and TypeScript. All you need to do is to import it and inject it into our component/service. Specifically, the client will consume the service created in Building a RESTful Web Service with CORS. In general, however, asynchronous requests should be preferred to synchronous requests for performance reasons. While we covered how to set up basic routes, access parameters and link to other components, we haven't really talked about more sophisticated use cases like protecting routes. I've checked it multiple times that the request doesn't make it to Server side (My Java code). Multiple dependencies were needed during the module setup and the faked connections were only available through an Observable object. 2 and the Angular CLI. In this post, we will learn about httprequest - Http post and get request in angular 6 with an example. Years passed and Angular 2 came out, completely rewritten from the ground up. Regarding multiple services – I believe it’s an expected approach where different entities have separate services. Our goal is simple: to help developers better understand Angular and embrace the practice of writing more secure code. Angular2: HTTP Get with multiple query string term Using Observable in Angular 2 Application Standard The Angular Http client communicates with the server using a familiar HTTP request/response protocol. A collection of properties that represent the presence of different browser features or bugs. In other words, interceptors define general rules for how your application processes HTTP requests and responses. NET Web API and C# by extending the solution developed in the previous article - Angular 4 QR Code Generator using ASP. This may take a few minutes to create the. Natively works with Angular The latest versions of jQWidgets are built natively for Angular. One common scenario is to wait for a number of requests to finish before continuing. Juri Strumpflohner Follow Juri is a full stack developer and tech lead with a special passion for the web and frontend development. data a string, or an object, carrying the response from the server. Angular 2 - Sending multiple HTTP POST requests one at a time Help Request Hello, I’m trying to figure how to send post requests one at a time as the API I’m using will only allow that. It consumes less space and easy to handle but for this, you need to customize the element. In most cases, those HTTP requests work well and return the desired result. Wait till response comes from $http request in AngularJS In this article, we are going to learn how to wait till the $http response comes from server using AngularJS. For almost two months I have promised myself a serious look at angular and what it can do for me in the corporate world. Creates a request options object to be optionally provided when instantiating a Request. This post is about the architecture of the application which uses AngularJS. While we covered how to set up basic routes, access parameters and link to other components, we haven't really talked about more sophisticated use cases like protecting routes. A set of selected questions and answers of Angular 2 that helps you to clarify the concepts of Angular 2 Reading interview questions is one of the great ways to learn and brush up the left-over concepts even if you are not preparing for the interview. statusText a string defining the HTTP status. NET Web API and C#. This can be accomplished using the forkJoin method. 0, AngularJS 2. It is making requests to server side Rest APIs, which is in Java, Spring boot. NET Core Angular Starter Project. Since Http is …. Introduction. Although it takes getting used to after years of writing server-side code, it simplifies a lot of backend logic in our projects and we've had wonderful success with it so far. The previous post, We had introduced how to set up an Angular 4 App with SpringBootSuite. angular — accessing data of multiple http calls - how to resolve the promises and that the http request have been passed to the event queue. With Angular 7, when you create an app with the default app generator, it creates two basic environment files: development and production. When user fill in the data and click on the Submit button, we are serializing form to HTTP form data format using $. An Example: Automatically Adding CSRF Tokens To demonstrate a useful task for interceptors, let's use the request property to automatically add a csrf token to every request made to the domain test-routes. An in-memory web api for Angular demos and tests that emulates CRUD operations over a RESTy API. Luckily for us, there is an elegant way to execute multiple HTTP requests in Angular 2/4 and wait for all of them to complete. The app was using the HttpClient introduced in Angular 4. In this post, we will cover both. With AngularJS 2. This also allows you to use your own custom domain with an HTTP function. This new module is available in package @angular/common/http and a complete re-implementation of the former HttpModule. It is important to write tests for our. Fetching numerous asynchronous requests and managing them can be tricky but with the Angular’s Http service and a little help from the included RxJS library, it can be accomplished in just a few of lines of code. Let's now see some other very frequent use cases, plus some more new features of the Angular HTTP client. Then when requests fail due to errors an interceptor handles those that are tagged. Ajax requests in jQuery do both Controller Put and Delete requests. Building a REST-Backend for Angular with Node. all, making your project's code cleaner and more testable. The main purpose is to use one Loading spinner process for multiple RESTful API requests of the Angular 8 Web Application. Used to set request headers. Connect your Angular App with your Backend using the Http-Client. Step by step tutorial to learn how set headers for every request in Angular using HttpInterceptor. Although we could have easily launched those HTTP requests from within the controller itself, it is a good idea to use providers to handle the heavy lifting in the application - especially as the application starts to become more complex. js, we can see the terminal output “Request made to /space/” every time we refresh the Angular page since the requests are now going to the Node server. ts file directly. Configuring the caching clientside might come in handy in those circumstances. Making HTTP requests is a vital operation in the life of most front-end applications. How to Wait for Angular2 to Handle Dynamic Multiple Http Requests. When user fill in the data and click on the Submit button, we are serializing form to HTTP form data format using $. If we look under request headers, under the headers tab we can see we have an authorization header with a bearer token, so the interceptor's working and it's adding it to all of our HTTP requests. 1 there is a new, way more simpler approach of implementing HTTP interceptors. In Angular 4. The application issues two search requests, one for angular and one for http. The transform. Use Http Client In Game Service. So, when I say client side, I mean the UI part which is in Angular. Of course, we may handle all the HTTP requests from every component and process the response as well, but it is not a good practice. Making multiple http request Angular2. Typical defaults can be found in the BaseRequestOptions class, which sub-classes RequestOptions. There are multiple ways to handle multiple requests; they can be sequential or in parallel. Fork joins in angular Fork joins in angular are used to help to handle the concurrent request. I've checked it multiple times that the request doesn't make it to Server side (My Java code). Angular 2, which is the hottest thing right now has a really cool way of doing that. Tutorial built with Angular 8. This Introduction to AngularJS training course will provide an introduction to the benefits of AngularJS so course participants can start effectively leveraging the framework. Angular has its own HTTP module that works with Angular apps. AJAX calls via the $http service. 0 and we are already getting started on 4. NET Web API and C#. This also allows you to use your own custom domain with an HTTP function. Angular 2 - Sending multiple HTTP POST requests one at a time Help Request Hello, I’m trying to figure how to send post requests one at a time as the API I’m using will only allow that. Angular 5: Making API calls with the HttpClient service By Keith Dechant , Software Architect, November 27, 2017 The same techniques will work with Angular 6 as long as you use the rxjs-compat Node package. Having requests return observables is great because we will be able to use RxJS's operators to get the returned streams behave the way we like. Figure 1: Scenario of accessing multiple REST APIs from Angular Client Application. parent request. com – Examples, The best For Learn web development Tutorials,Demo with Example!. Although it takes getting used to after years of writing server-side code, it simplifies a lot of backend logic in our projects and we've had wonderful success with it so far. Introduction. In other words, interceptors define general rules for how your application processes HTTP requests and responses. Since Http is …. Promises are a core feature of AngularJS - whether you understand them or not, if you use AngularJS you've almost certainly been using them for a while. Angular has its own HTTP module that works with Angular apps. If we look under request headers, under the headers tab we can see we have an authorization header with a bearer token, so the interceptor's working and it's adding it to all of our HTTP requests. We have designed the latest Angular, AngularJS 1. status a number defining the HTTP status. 🚅 Well, the network might be slow, and the HTTP request still returns the desired result. We will create a sample project which name is 'multiple_angularjs_datatables' in HTTP web server. Always return a new promise from each `then` and then you can chain them, like [code]$http. I have 2 controllers calling the same service on different user interactions.