简体   繁体   English

通过路由从多个config.js文件中的角度更改页面标题

[英]Changing page title via route from multiple config.js files in angular

I have an angular app that loads different locations which should all have different page titles. 我有一个有角度的应用程序,可加载不同的位置,所有位置均应具有不同的页面标题。 I've seen many posts of how showing how to do if from the route, but my route actually pulls location data from config files that contain specific data for each location. 我已经看过许多关于如何显示如何从路由中执行操作的文章,但是我的路由实际上是从包含每个位置的特定数据的配置文件中提取位置数据。

Can someone direct me to a Technique that will facilitate this when using values from an object in the config file? 有人可以指导我使用在配置文件中使用对象值的技术吗?

I wanted to post the answer to this. 我想发布答案。 My Route pointed to a config file that loaded different stylesheets, location information, Hours, Phone Numbers etc. In order to pull custom page title for each of the locations, the title had to live in the config.js file. “我的路线”指向一个配置文件,该文件加载了不同的样式表,位置信息,小时数,电话号码等。为了提取每个位置的自定义页面标题,该标题必须位于config.js文件中。 The config file contained a AppConfig object that was declared outside of the scope angular so it is available anywhere in the app. 配置文件包含一个AppConfig对象,该对象在范围angular之外声明,因此可以在应用程序中的任何位置使用。 Then I called that value into the parent app controller and set title using ng-bind="title". 然后,我将该值调用到父应用程序控制器中,并使用ng-bind =“ title”设置标题。 This will also allow for all other locations to have separate page title just by calling their config.js. 通过调用config.js,这还将允许所有其他位置具有单独的页面标题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM