Need to create resource bundle

Hello All,

I need to create resource bundle type of file in ember. Can anybody please help me in guiding how to do it?

Thanks & Regards, Priyanka

Hi @parekhpiya2002, wha do you mean by “resource bundle type”?

Thanks for your response. I need to create a single file in which i will list all configurable parameters required in project and will call anywhere its required.

It will be useful for data re usability.

Do you have any idea about the same?

Are you familiar with JavaScript modules? You can export an object, and then import that module from anywhere, similar to the config module. See documentation for the utils folder.

Actually,I am new to JS and ember too. Can you please provide me any reference link?

Thanks & Regards, Priyanka

@parekhpiya2002 Just trying to clarify something. As I understand, you want to create environment specific variables?

For example, if you want to specify a different api URL on development and production, you can do the following:

  1. Open app/config/environment.js
  2. Define your value, like so: ENV.apiURL = "http://localhost:3000" inside the environment === 'development' check.
  3. Repeat the above step for every environment

Then, to access your configuration, in any other route/component, you can do at the top: import config from "../../path/to/config/environment"

and then access the variable using config.apiURL.

Thanks for reply.

I will try this first

cool, let me know how it goes!

i have added one configurable parameter in environment.js as ‘ENV.Create_Table = “Create Table”;’

How i can print this value on .hbs file?

Thanks & Regards, Priyanka

You might want to use ember-i18n ( for localization needs, and define translation files as json.

Thanks for your reply but i dont want to set language file. I want to store some environment variables in single file so that it can be easily reusable and easy for updation.

Thanks & Regards, Priyanka

Like @locks mentioned, now that you have your createTable variable in your environment config you can simply import it in your controller for use in your template.

So your controller would look something like:

// application controller
import Ember from 'ember';
import config from '/path/to/environment/config';

export default Ember.Controller.extend({
    createTable: config.createTable   //this makes the value available for use in the template

And then your in your template

{{!-- application.hbs --}}