Unable to use ng-include in angular 5

update angular 7+

  1. create a class that implements OnInit

  2. add the module in app.module.ts

    @Component({
    selector: 'app-device',
    templateUrl: '../views/device.component.html',
    
    })
    
    export class DeviceComponent implements OnInit{
    
    
    ngOnInit(): void {
    }
    
    
    
    }
    

    add in the view

    <app-device></app-device>
    

Angular doesn't have a ng-include as AngularJS used to have.

In Angular, you can create a component like this:

@Component({
    selector: 'app-device',
    templateUrl: './device.html'
})
class DeviceComponent {}

And then, instead of:

<div ng-include="'templates/device.html'">

you do:

<app-device></app-device>