question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scope only for given component

See original GitHub issue

I have multiple components of the same type on a page where following *blockUI attribute is defined. <table *blockUI="'results-table'">

In the ts file I reference BlockUI like this: @BlockUI('results-table') public blocker: NgBlockUI;

The problem is that when I trigger blocker.start('Please wait')

All of components become ‘busy’ (because of the same identifier). But I need to make busy only the one in a particular instance. Yes, they can be distinguished by various names, but it is the same component.

Is there any possibility to trigger start only for a blocker on a current instance?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kuuurt13commented, Mar 13, 2020

@MichalJakubeczy table (or in your example results-table) is the name for blockUI to target when dispatching the start/stop events. So when you call this.blockUI.start() it will dispatch a start event targeting table. Any blockUI directives that are passed table as its name (in any template) will then start blocking (*blockUI="'table'"). The reason you ran into your issue is that all your components were using the same name and currently blockUI uses the same instance for all components so all were started when you called start.

So what needs to happen is a unique name needs to be created for each instance of a component and then that unique name needs to be passed to the directive. That way when start is called it will use the unique name that both the component and its template share. So what I want to do is that when you pass { isScoped: true } the library will create a unique block name with table such as table-<unique-guid> and you will have to pass blockUI.name to the directive so the blockUI instance and the directive share the same unique name.

Anyway, I have started working on this and I have an initial proof of concept working so I should be able to roll this into the upcoming 3.0.0 release, I will keep you posted.

0reactions
kuuurt13commented, Jun 26, 2020

Fixed by #113

Read more comments on GitHub >

github_iconTop Results From Across the Web

scope - CSS: Cascading Style Sheets - MDN Web Docs
The :scope CSS pseudo-class represents elements that are a reference point for selectors to match against. Currently, when used in a stylesheet ...
Read more >
Scope components to one or more applications - Dapr Docs
Application scopes added to a component limit only the applications with specific IDs from using the component.
Read more >
Dagger2 what is the purpose of adding a scope tag to ...
You can specify only one scope on a given component, and in a scoped component, you can only have modules with that scope...
Read more >
Developer Guide: Scopes - AngularJS: API
Scopes provide APIs ($apply) to propagate any model changes through the system into the view from outside of the "AngularJS realm" (controllers, services, ......
Read more >
Scopes - ComponentKit
Scopes give ComponentKit the ability to assign any component with a persistent identity: regardless of how many times a component is created it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found