Skip to content

Commit 80df8f1

Browse files
ikoevskarigor789
authored andcommitted
Reworked for style and formatting (#155)
1 parent 5a866dc commit 80df8f1

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

content/docs/en/utilities/v-view.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,53 @@
11
---
2-
title: v-view directive
3-
contributors: [rigor789, eddyverbruggen]
2+
title: v-view
3+
contributors: [rigor789, eddyverbruggen, ikoevska]
44
---
55

6-
The `v-view` directive is used to set the current elements `View` as a parent property.
6+
The `v-view` directive lets you set the current element's `View` as a parent property.
77

8-
### Usage
8+
---
99

10-
```html
10+
```HTML
1111
<Child v-view:parentPropertyName />
1212
<!-- same as: -->
1313
<Child ~parentPropertyName />
1414
```
1515

16-
```html
16+
```HTML
1717
<Child v-view:parentArrayPropertyName.array />
1818
<!-- same as: -->
1919
<Child ~parentArrayPropertyName.array />
2020
```
2121

2222
---
2323

24-
There are many `NativeScript` components that require setting a property to a valid `View` instance, which is not possible using a template. Using this directive saves time by not having to register new directives / references to parent elements, and setting the parent properties manually.
24+
### Example: `<RadSideDrawer>`
2525

26-
To better illustrate what this directive does, let's take a look at the `RadSideDrawer` component from the [Progress NativeScript UI](http://docs.telerik.com/devtools/nativescript-ui/Controls/Angular/SideDrawer/getting-started) package:
26+
The `<RadSideDrawer>` component is part of the [Progress NativeScript UI](http://docs.telerik.com/devtools/nativescript-ui/Controls/Angular/SideDrawer/getting-started) package.
2727

28-
The `RadSideDrawer` component expects the `drawerContent` and `mainContent` properties to be set to `View` instances,
29-
using the `v-view` directive it would look like this:
28+
The `<RadSideDrawer>` component requires the `drawerContent` and `mainContent` properties to be set to `View` instances. Using the `v-view` directive, you can do this with a few lines of code:
3029

31-
```html
30+
```HTML
3231
<RadSideDrawer>
3332
<StackLayout ~drawerContent />
3433
<StackLayout ~mainContent />
3534
</RadSideDrawer>
3635
```
3736

38-
Without this directive you would have to do something like:
37+
Without the `v-view` directive, you need to go a more tedious and error-prone route:
3938

40-
```html
39+
```HTML
4140
<RadSideDrawer ref="drawer">
4241
<StackLayout ref="drawerContent" />
4342
<StackLayout ref="mainContent" />
4443
</RadSideDrawer>
4544
```
4645

47-
```javascript
46+
```JavaScript
4847
{
4948
mounted() {
5049
this.$refs.drawer.nativeView.drawerContent = this.$refs.drawerContent.nativeView
5150
this.$refs.drawer.nativeView.mainContent = this.$refs.mainContent.nativeView
5251
}
5352
}
54-
```
55-
56-
Which can get tedious and is very error prone.
53+
```

0 commit comments

Comments
 (0)