Angular
Integrate DynamicMapper into your Angular application
Install
npm i @dynamic-mapper/angular --saveImport MapperModule and profile providers
import { MapperModule } from '@dynamic-mapper/angular';
@NgModule({
imports: [
MapperModule.withProfiles([CustomerProfile, OrderProfile])
]
})
export class AppModule {}Inject mapper service
import { Mapper } from '@dynamic-mapper/angular';
@Injectable()
export class CustomerService {
constructor(private readonly mapper: Mapper) {}
toDto(customer: Customer) {
return this.mapper.map(CustomerProfile.DomainToDto, customer);
}
}Last updated
Was this helpful?