How to inject base href ?
How to inject base href ?
To inject the base href in an Angular application, you can use the APP_BASE_HREF token provided by Angular. This token allows you to configure the base href dynamically during the runtime of your application, rather than statically in the index.html file. Here’s how you can do it:
Import the Necessary Modules:
First, you need to import APP_BASE_HREF from @angular/common in your module where you want to provide the base href.
import { APP_BASE_HREF } from '@angular/common';
Provide the APP_BASE_HREF in Your Module:
In the module (typically the app module), you can provide a value for APP_BASE_HREF using Angular's dependency injection framework. You can set this value based on any logic or configuration you have in your application.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.