@acomici/directives 中文文档教程
Acomici Common Directives
这个存储库包括所有其他 Acomici 存储库中使用的最常见的 Angular 指令。 欢迎 PR 和问题。
此项目是使用 Angular CLI 版本 11.0.3 生成的。
Included Directives
- acomiIsOutside: Detect when user click outside the DOM
- acomiCarousel: Simple carousel effect wrapper.
- acomiOverCounted: Simple over-counted number effect.
acomiIsOutside
在您的组件模块中。
@NgModule({
imports: [
ClickOutsideModule
],
})
export class SomeModule {
}
并在 HTML 组件中使用 在
<div acomiIsOutside (isOutside)="isClickingOutside($event)" (outside)="whenOutside()">
Some DOM
</div>
// your component.ts
/**
* `isOutSide` will be true if user click outside the DOM.
* and false when click inside the DOM (or any child DOM)
* this is useful if you want to detect exactly when user click in or outside the DOM.
*/
isClickingOutside(isOutside: boolean) {
// ...
}
/**
* Use this if you only want to trigger when user click outside the DOM.
*/
whenOutside() {
// ...
}
acomiCarousel
组件的模块中。
@NgModule({
imports: [
CarouselModule
],
})
export class SomeModule {
}
- Updating…
acomiOverCounted
在您的组件模块中。
@NgModule({
imports: [
OverCountedModule
],
})
export class SomeModule {
}
- Updating…
Future document improvement:
每个指令的文档将被构建,因为一些指令有很多选项(acomiCarousel)。
Acomici Common Directives
This repository includes most common Angular directives that are used in all other Acomici repositories. PR and issues are welcomed.
This project was generated with Angular CLI version 11.0.3.
Included Directives
- acomiIsOutside: Detect when user click outside the DOM
- acomiCarousel: Simple carousel effect wrapper.
- acomiOverCounted: Simple over-counted number effect.
acomiIsOutside
In your component's module.
@NgModule({
imports: [
ClickOutsideModule
],
})
export class SomeModule {
}
And use in HTML component
<div acomiIsOutside (isOutside)="isClickingOutside($event)" (outside)="whenOutside()">
Some DOM
</div>
// your component.ts
/**
* `isOutSide` will be true if user click outside the DOM.
* and false when click inside the DOM (or any child DOM)
* this is useful if you want to detect exactly when user click in or outside the DOM.
*/
isClickingOutside(isOutside: boolean) {
// ...
}
/**
* Use this if you only want to trigger when user click outside the DOM.
*/
whenOutside() {
// ...
}
acomiCarousel
In your component's module.
@NgModule({
imports: [
CarouselModule
],
})
export class SomeModule {
}
- Updating…
acomiOverCounted
In your component's module.
@NgModule({
imports: [
OverCountedModule
],
})
export class SomeModule {
}
- Updating…
Future document improvement:
Document for each directive will be constructed as some directive have lots of options (acomiCarousel).