在我的Ember应用程序(基于引擎)中,我没有在localhost URL中看到哈希
我确实尝试在environment.js中更改locationType
locationType:'hash'
虽然路由&一切正常,我只是想知道如何在地址栏网址中获得#。
以下是我的完整环境.js
/*jshint node:true*/
'use strict';
module.exports = function(environment, appConfig) {
console.log(environment);
var ENV = {
modulePrefix: 'myapp-ui',
environment: environment,
rootURL: '/myapp/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
TRACKING_ENABLED: true,
LOG_TRACKING_ENABLED: false,
ROUTE_TRANSITION_TRACKING_ENABLED: false,
LOG_ERROR_TRACKING: true,
ANALYTICS_URL:"X",
ANALYTICS_SITE_ID:0,
STUB_MODE : false,
SET_LOCALE : true
};
if (environment && environment !== 'development') {
ENV.rootURL = "";
}
return ENV;
};
答案 0 :(得分:1)
将您的<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app = "app">
<div ng-controller = "AppCtrl as ctrl1">
{{ctrl1.getSearchQuery()}}
</div>
<div ng-controller = "AppCtrl as ctrl2">
<input type="search" ng-model = "ctrl2.variable" ng-change="ctrl2.setSearchQuery()"/>
{{ctrl2.variable}}
</div>
</div>
config/environment.js
配置选项更新为locationType
,重新启动您的Ember服务器。
hash
引自Ember guies,
您可以在
locationType: 'hash', // inside ENV
下的config / environment.js中更改此选项。
https://guides.emberjs.com/v2.2.0/configuring-ember/specifying-url-type/
答案 1 :(得分:0)