- EmberJS 教程
- EmberJS — 主頁
- EmberJS — 概述
- EmberJS — 安裝
- EmberJS — 核心概念
- 建立並執行應用
- EmberJS — 物件模型
- EmberJS — 路由
- EmberJS — 模板
- EmberJS — 元件
- EmberJS — 模型
- EmberJS — 管理依賴項
- EmberJS — 應用關注點
- EmberJS — 配置 Ember.js
- EmberJS — Ember Inspector
- EmberJS 有用資源
- EmberJS — 快速指南
- EmberJS — 有用資源
- EmberJS — 討論
EmberJS — 配置應用和 Ember CLI
你可以配置 Ember App 和 CLI 以管理應用環境。環境配置檔案位於 config/environment.js。它包含以下程式碼結構 −
module.exports = function(environment) {
var ENV = {
modulePrefix: 'query-params', //it is the name of application
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
API_HOST: 'https://:3000'
}
};
if (environment === 'development') {
//code here
}
if (environment === 'test') {
//code here
}
if (environment === 'production') {
}
return ENV;
};
ENV 物件包含以下三個鍵 −
EmberENV − 它提供 Ember 功能標誌。
APP − 用來向你的應用例項傳遞標誌/選項。
environment − 它提供當前環境名稱,例如 development、production 和 test。
配置 Ember CLI
你可以透過向 .ember-cli 檔案(位於你應用的根目錄下)新增配置來配置 Ember CLI。
例如,你可以使用命令 ember server --port 8080 從命令列傳遞埠號。此配置可以新增到 .ember-cli 檔案中,如下所示 −
{
"port" : 8080
}
emberjs_configuring_emberjs.htm
廣告