Hassen Tayech
Hassen Tayech

Reputation: 51

how to integrate a html template in angular 7 project

I'm integrating a html template in angular 7 project and it is not working correctly

I added the template files under assets/template/.. and i added the imports in angular.json like:

I edited the html code :

(like src="/assets/template/img/slider/1.jpg" alt="main slider" title="#htmlcaption1")

I added the html code in index.html under the app-root tag and all working fine

But when i change it to app.component.html :

and I don't have any error in my console

Upvotes: 5

Views: 4400

Answers (2)

Rohit Tiwari
Rohit Tiwari

Reputation: 1

Just add encapsulation: ViewEncapsulation.None in @component like below mentioned.

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css'],
    encapsulation: ViewEncapsulation.None
})

Upvotes: 0

Bhargav Reddy
Bhargav Reddy

Reputation: 93

I usually don't use styles array in angular.json, Instead, I import all global styles in styles .css as it is set into angular.json styles array by default.

/* You can add global styles to this file, and also import other style files */

@import "assets/quote.css";

@import "https://fonts.googleapis.com/css?family=IBM+Plex+Sans+Condensed:200|Josefin+Sans:300|Julius+Sans+One|Merriweather+Sans:400|Overpass:400|Quicksand"

Upvotes: 2

Related Questions