Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@analogjs/astro-angular
Advanced tools
An Angular integration for rendering components in Astro
Use the astro add
command to install the integration
astro add @analogjs/astro-angular
This command:
@analogjs/astro-angular
package.@analogjs/astro-angular
integration to the astro.config.mjs
file.@angular/common
and @angular/forms
.The integration needs a tsconfig.app.json
at the root of the project for compilation.
Create a tsconfig.app.json
in the root of the project.
{
"extends": "./tsconfig.json",
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"noEmit": false,
"target": "es2020",
"module": "es2020",
"lib": ["es2020", "dom"]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
},
"files": [],
"include": ["src/**/*.ts"]
}
Go to Defining A Component to set up an Angular component to use in an Astro component.
The integration can also be installed manually
yarn add @analogjs/astro-angular --dev
yarn add @angular-devkit/build-angular, @angular/animations, @angular/common, @angular/compiler-cli, @angular/compiler, @angular/core, @angular/language-service, @angular/forms, @angular/platform-browser, @angular/platform-browser-dynamic, @angular/platform-server, rxjs, zone.js, tslib --dev
Add the integration to the astro.config.mjs
import { defineConfig } from 'astro/config';
import angular from '@analogjs/astro-angular';
export default defineConfig({
integrations: [angular()],
});
Go to Defining A Component
The Astro Angular integration only supports rendering standalone components:
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
@Component({
selector: 'app-hello',
standalone: true,
imports: [CommonModule],
template: `
<p>Hello from Angular!!</p>
<p *ngIf="show">help</p>
<button (click)="toggle()">Toggle</button>
`,
})
export class HelloComponent {
show = false;
toggle() {
this.show = !this.show;
}
}
Add the Angular component to the Astro component template. This only renders the HTML from the Angular component.
---
import { HelloComponent } from '../components/hello.component.ts';
---
<HelloComponent />
To hydrate the component on the client, use one of the Astro directives:
---
import { HelloComponent } from '../components/hello.component.ts';
---
<HelloComponent client:visible />
Find more information about Client Directives in the Astro documentation.
FAQs
Use Angular components within Astro
The npm package @analogjs/astro-angular receives a total of 453 weekly downloads. As such, @analogjs/astro-angular popularity was classified as not popular.
We found that @analogjs/astro-angular demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.