You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>When you host a component, you can control the overlay through <code>ToppyOverlay</code> service. Using this service you can access all properties that is provided in content. Also the properties comes with <code>close</code>.</p>
<p>When you are adding content, optionally you can add additional custom data to them. Which can be accessed later inside the content. This applies only if the content type is <strong>Component</strong> or <strong>TemplateRef</strong>. The data will be auto attached with the content and comes with <code>close</code> property, to dismiss the overlay programatically.</p>
<spanclass="hljs-built_in">console</span>.log(<spanclass="hljs-keyword">this</span>.overlay.props.propName); <spanclass="hljs-comment">// will return 'toppy-test-prop'</span>
<spanclass="hljs-built_in">console</span>.log(<spanclass="hljs-keyword">this</span>.propName); <spanclass="hljs-comment">// will return 'toppy-test-prop'</span>
Copy file name to clipboardExpand all lines: docs/markdown/main.md
+11-15Lines changed: 11 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,11 +157,11 @@ new SlidePosition({
157
157
newFullscreenPosition();
158
158
```
159
159
160
-
### []{.toppy-icon .icon-rss} Communication
160
+
### []{.toppy-icon .icon-rss} Content Properties
161
161
162
-
##### Component Data
162
+
When you are adding content, optionally you can add additional custom data to them. Which can be accessed later inside the content. This applies only if the content type is **Component** or **TemplateRef**. The data will be auto attached with the content and comes with `close` property, to dismiss the overlay programatically.
163
163
164
-
When you host a component, you can control the overlay through `ToppyOverlay` service. Using this service you can access all properties that is provided in content. Also the properties comes with `close`.
164
+
##### Component Props
165
165
166
166
```typescript
167
167
this.overlay=this._toppy
@@ -176,19 +176,19 @@ this.overlay = this._toppy
176
176
template: '<div>Some text</div>'
177
177
})
178
178
exportclassHelloComponent {
179
-
constructor(publicoverlay:ToppyOverlay) {
180
-
console.log(this.overlay.props.propName); // will return 'toppy-test-prop'
179
+
propName; // declare. Else TSlint throws error
180
+
close; // just declare
181
+
constructor() {
182
+
console.log(this.propName); // will return 'toppy-test-prop'
181
183
}
182
184
183
-
close() {
184
-
this.overlay.close();
185
+
dismiss() {
186
+
this.close();// auto binded
185
187
}
186
188
}
187
189
```
188
190
189
-
##### Template Data
190
-
191
-
This is very similar to above one. When you use template as a content, you can pass additional data to it.
191
+
##### Template props
192
192
193
193
```typescript
194
194
this.overlay=this._toppy
@@ -197,18 +197,14 @@ this.overlay = this._toppy
197
197
.create();
198
198
```
199
199
200
-
Then in your template you can refer the data like this,
0 commit comments