46412

Get RESTAdapter host

RESTAdapter has the possibility to specify a url for the backend:

DS.RESTAdapter.reopen({ url: 'https://api.example.com' });

How can I access this property programmatically? I mean something like: DS.RESTAdapter.get('url') <-This doesn't work

Answer1:

You're setting the properties on the class not the instance, thats why you can't retrieve the values. There are two possible solutions.

You can get the values from the prototype

DS.RESTAdapter.prototype.url

or you can instantiate the class and get it from there

DS.RESTAdapter.create().url

Answer2:

Quick and dirty ...

NOTE: Please use only for debugging, this API is intern and will cenrtainly change in the future, so don't rely on it.

Assuming you have only one Store in your application:

App.__container__.lookup('store:main').get('adapter.url')

If you are using Chrome Dev Tools you can try to call this from the console, it should print out the url used by the default adapter used by the default Store. But it's discouraged to be used for other then for debugging.

Hope it helps

Answer3:

Or

DS.defaultStore.adapter.url

Recommend

  • ant copy copying order
  • Found com.google.android.gms:play-services-places:9.2.1, but version 9.0.2 is needed for the google-
  • Per Machine App Registration
  • Quickly or concisely determine the longest string per column in a row-based data collection
  • NetBeans doesn't see style.css [duplicate]
  • GitHub default README markup
  • integrate POCO library in android ndk
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • how to populate a SQLite database and use that database in phonegap?
  • Creating a DropDownList
  • How to autopopulate a field in SugarCRM form
  • List images(01.png) and descriptions(01.txt) from directory
  • Authentication in Play! and RestEasy
  • Copy to all folders batch file?
  • gspread or such: help me get cell coordinates (not value)
  • Unable to get column index with table.getColumn method using custom table Model
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • How to match http request and response using Jersey ContainerRequestFilter and ContainerResponseFilt
  • How to test if a URL from an Eclipse bundle is a directory?
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Highlight one bar in a series in highcharts?
  • Q promise. Difference between .when and .then
  • Can I display google adwords (AdView) in javafx on android
  • Can I make an Android app that runs a web view in Chrome 39?
  • Convert array of 8 bytes to signed long in C++
  • Calling of Constructors in a Java
  • How do I rollback to a specific git commit
  • Comma separated Values
  • PHP: When would you need the self:: keyword?
  • Error creating VM instance in Google Compute Engine
  • C# - Getting references of reference
  • Hits per day in Google Big Query
  • Understanding cpu registers
  • how does django model after text[] in postgresql [duplicate]
  • Java static initializers and reflection
  • unknown Exception android
  • Recursive/Hierarchical Query Using Postgres
  • Running Map reduces the dimensions of the matrices
  • Observable and ngFor in Angular 2
  • Unable to use reactive element in my shiny app