Skip to content

Commit 106d68e

Browse files
committed
docs(bidirectionality): bidirectionality how-to explanation
1 parent b00f838 commit 106d68e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

guides/bidirectionality.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Angular Material bi-directionality
2+
3+
### How to set your application direction
4+
The simplest way is applying `dir` attribute on either the `html` or `body` tags.
5+
All material components would automatically inherit the application direction.
6+
7+
You can change the direction for a specific part of you application by applying `dir` attribute on the container element.
8+
9+
### How to develop bi-directional components
10+
In your component import `Directionality` out of `@angular/cdk`
11+
And inject it in your component constructor
12+
```ts
13+
constructor(_dir: Directionality) {
14+
console.log(_dir.value);
15+
}
16+
```
17+
Now you have access to the application direction,
18+
You can also subscribe to `change`:
19+
```ts
20+
_dir.change.subscribe(() => // DO SOMETHING );
21+
```
22+
And be notified for every direction change.

0 commit comments

Comments
 (0)