Angular-cli: Conditional syntax in index.html

Created on 31 Jan 2017  路  7Comments  路  Source: angular/angular-cli

Please provide us with the following information:

OS?

Ubuntu 16.04

Versions.

angular-cli: 1.0.0-beta.24
node: 7.2.1

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
My app was created using the CLI

The log given by the failure.

Normally this include a stack trace and some more information.

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

When you start the ng serve I use a dev environment. In my index.html the title tag written "Test". How to change title in index.html depending on the environment?

I tried to use the syntax as in this example: https://github.com/angular/mobile-toolkit/blob/master/hello-mobile/src/index.html
it's not work.

Thank's

Most helpful comment

@figuerres sorry, maybe I not clear ask the question. For webpack there is plugin html-webpack-plugin
https://github.com/jantimon/html-webpack-plugin
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates
this syntax is used by this plugin when building app on angular (asp.net nothing to do with)

All 7 comments

unless i am mistaken this is something to ask the mobile toolkit folks. normally with an angular app the index html file is static.

@figuerres
not only mobile. Yes, In mobile app and desktop app index.html is static.
syntax works when build project. Example:
https://github.com/AngularClass/angular2-webpack-starter/blob/master/src/index.html

I want to know what syntax is used in build "ng build" What plugin is used in "ng build ". If it is not there then how to add it

@a50 the new link you give is totally different and has markup that looks like it goes for asp.net not for angular.

< % is used by asp.net code on the server before the browser ever gets it.

if you just want to modify the title of the html i think you can do that in your app component code. I think this is a general angular / typescript / javascript issue not one that is for the cli

@figuerres sorry, maybe I not clear ask the question. For webpack there is plugin html-webpack-plugin
https://github.com/jantimon/html-webpack-plugin
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates
this syntax is used by this plugin when building app on angular (asp.net nothing to do with)

This isn't a feature we are looking at adding.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings