mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 14:42:20 +08:00
Docs: run the api-extractor on master to update docs (#23726)
* regenerated packages docs. * fixed spelling issues. * fixed spelling issues.
This commit is contained in:
@ -10,6 +10,8 @@ draft = true
|
||||
|
||||
## AngularComponent interface
|
||||
|
||||
Used to enable rendering of Angular components within a React component without losing proper typings.
|
||||
|
||||
<b>Signature</b>
|
||||
|
||||
```typescript
|
||||
@ -20,16 +22,49 @@ export interface AngularComponent
|
||||
```typescript
|
||||
import { AngularComponent } from '@grafana/runtime';
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```typescript
|
||||
class Component extends PureComponent<Props> {
|
||||
element: HTMLElement;
|
||||
angularComponent: AngularComponent;
|
||||
|
||||
componentDidMount() {
|
||||
const template = '<angular-component />' // angular template here;
|
||||
const scopeProps = { ctrl: angularController }; // angular scope properties here
|
||||
const loader = getAngularLoader();
|
||||
this.angularComponent = loader.load(this.element, scopeProps, template);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.angularComponent) {
|
||||
this.angularComponent.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div ref={element => (this.element = element)} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
<b>Methods</b>
|
||||
|
||||
| Method | Description |
|
||||
| --- | --- |
|
||||
| [destroy()](#destroy-method) | |
|
||||
| [digest()](#digest-method) | |
|
||||
| [getScope()](#getscope-method) | |
|
||||
| [destroy()](#destroy-method) | Should be called when the React component will unmount. |
|
||||
| [digest()](#digest-method) | Can be used to trigger a re-render of the Angular component. |
|
||||
| [getScope()](#getscope-method) | Used to access the Angular scope from the React component. |
|
||||
|
||||
### destroy method
|
||||
|
||||
Should be called when the React component will unmount.
|
||||
|
||||
<b>Signature</b>
|
||||
|
||||
```typescript
|
||||
@ -41,6 +76,8 @@ destroy(): void;
|
||||
|
||||
### digest method
|
||||
|
||||
Can be used to trigger a re-render of the Angular component.
|
||||
|
||||
<b>Signature</b>
|
||||
|
||||
```typescript
|
||||
@ -52,6 +89,8 @@ digest(): void;
|
||||
|
||||
### getScope method
|
||||
|
||||
Used to access the Angular scope from the React component.
|
||||
|
||||
<b>Signature</b>
|
||||
|
||||
```typescript
|
||||
|
Reference in New Issue
Block a user