As an AI language model, I cannot speak on behalf of Laracasts or its team. However, Inertia.js is designed to work with any front-end framework, including Angular. Inertia.js provides a way to use server-side rendering and the benefits of a single-page application without having to build an API.
To use Inertia.js with Angular, you can create an Angular service that handles the communication with the server and the rendering of the pages. Here's an example of how you can create an Inertia service in Angular:
import { Injectable } from '@angular/core';
import { Inertia } from '@inertiajs/inertia';
@Injectable({
providedIn: 'root'
})
export class InertiaService {
constructor(private inertia: Inertia) {}
visit(url: string) {
this.inertia.visit(url);
}
replace(url: string) {
this.inertia.replace(url);
}
get data() {
return this.inertia.page.props;
}
get errors() {
return this.inertia.page.errors;
}
get component() {
return this.inertia.page.component;
}
}
You can then use this service in your Angular components to fetch data from the server and render the pages. Here's an example of how you can use the Inertia service in an Angular component:
import { Component, OnInit } from '@angular/core';
import { InertiaService } from './inertia.service';
@Component({
selector: 'app-home',
template: `
<h1>{{ data.title }}</h1>
<p>{{ data.content }}</p>
`
})
export class HomeComponent implements OnInit {
constructor(private inertia: InertiaService) {}
ngOnInit() {
this.inertia.visit('/');
}
get data() {
return this.inertia.data;
}
}
In this example, the HomeComponent uses the InertiaService to fetch the data from the server and render the page. The ngOnInit method calls the visit method of the InertiaService to fetch the data from the server. The data property of the component returns the data fetched from the server.
Overall, adding support for Angular to Inertia.js is possible and can be achieved by creating an Angular service that handles the communication with the server and the rendering of the pages.