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.

ng-option-tmp doesn't work in v3.0

See original GitHub issue

After update to version 3.0 the templates for ng-option-tmp are not shown anymore.

  • Browser chrome
  • Version 75
  • Angular 8.1

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
varnastadeuscommented, Sep 17, 2019

I agree, in case of wrapper control there is not much you can with static templates so this should be definitely changed 👍

3reactions
amazkovoicommented, Sep 10, 2019

@varnastadeus firstly, thank you for building such a solid and versatile component! We love using ng-select, and I think it’s the most complete and flexible select/auto-complete component out there.

We have recently upgraded to ng-select 3.0.6 (and Angular 8) and also hit this issue.

Our use case: we have built a “wrapper control” around ng-select. The wrapper control allows us to re-use some logic and look and feel across all usages of ng-select within our application.

The wrapper control accepts templates, and passes them to ng-select. For example, if the place where the wrapper control is used declares the ng-multi-label-tmp template, it will be passed to the ng-select. This allows the users of the wrapper control to decide which custom templates to use (if any).

To make this work, inside the wrapper control, we had to use conditional logic around the templates that are passed to ng-select. This worked very well in older versions of ng-select.

I am guessing that our use case is very similar to @dzonatan 's

The usage of “static: true” in ng-select when injecting custom templates, stops this functionality from working. As far as I can tell there is no way for us to have the same (awesome) flexibility that we had before. i.e. we cannot have a reusable wrapper control in place, as it cannot conditionally pass templates to ng-select.

It seems the main benefit of having “static: true” for templates is to have access to templates inside ngOnInit(), which ng-select does not need. The default in Angular now is (and will be in Angular 9) “static: false”, which allows for greater flexibility, which existed in previous versions.

To test, I have forked ng-select and set static to false, which appears to work very well.

Would it be possible to change static to false in ng-select?

I believe it will allow for greater flexibility, and also will make it more backwards compatible, as a few people seem to run into similar issues when upgrading: https://github.com/ng-select/ng-select/issues/1344 https://github.com/ng-select/ng-select/issues/1306

Again, thanks a lot for your awesome work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng-options not binding when it has preselected values
I gave this a shot - I changed the tags array to include an ID and it still doesn't work. The new values...
Read more >
Angular ng-select - npm
Getting started · Step 1: Install ng-select : · Step 2: Import the component module: · Step 3: Include a theme: · Step...
Read more >
Angular directives for Bootstrap - AngularUI
For Angular 2 support, check out ng-bootstrap , created by the UI Bootstrap team. Dependencies. This repository contains a set of native AngularJS...
Read more >
Why crontab scripts are not working? - Ask Ubuntu
Wait for /tmp/env.output to be created, then remove the job again. ... The best choice is to ensure that your crontab has a...
Read more >
Troubleshooting AWS Cloud9
Step 3: Add AWS Cloud9 access permissions to the group in Team Setup ... Issue: When you try to open an environment, the...
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