Comments (8)
I too was in need of this feature. In the end I simply modified the dropdownMenu directive to get what I needed. I'm still a novice at angular so my approach may seem kinda clunky, but this is what I did:
1)I added another property to the isolate scope of the dropdownMenu directive called showDropDown:
scope: {
dropdownMenu: '=',
dropdownModel: '=',
dropdownOnchange: '&',
showDropDown: '=' //I added this part
}
2)I added an ng-show to the template variable and set it equal to showDropDown
template = "<ul ng-show='showDropDown' class='dropdown'>\n <li ng-repeat='item in dropdownMenu'\n class='dropdown-item'\n dropdown-item-label='labelField'\n dropdown-menu-item='item'>\n </li>\n</ul>";
3)In my controller I had a true/false variable called dropdownEnabled(my controller and not the directives controller property):
$scope.dropdownEnabled = true;// or false depending on if you want to enable or disable the dropdown
4)In my html where I needed the dropdown I added the new property show-drop-down apart from the other existing properties and set it equal to dropdownEnabled.
<a href='' show-drop-down='dropdownEnabled ' dropdown-menu="ddMenuOptions" dropdown-model="ddMenuSelected" dropdown-onchange="dropDownItem(selected)">Open Dropdown</a>
from angular-dropdowns.
@DhruvPrakash thanks for the answer!
If you'd like to submit a pull request with your modifications I'd be happy to include it into the module.
One small request: change the showDropDown
property to be called dropdownDisabled
and change ng-show='showDropDown'
to ng-hide='dropdownDisabled'
from angular-dropdowns.
anything new? this would be a very nice addition.
from angular-dropdowns.
Pull requests are welcome!
from angular-dropdowns.
As of version 1.2.0, the dropdown-disabled
setting has been added thanks to @Chinokao.
from angular-dropdowns.
Seems like not working to me, is not disabled if i put dropdown-disabled="true" or false
from angular-dropdowns.
@asso1985 can you make a jsFiddle showing your problem? It seems to work on my example page http://jseppi.github.io/angular-dropdowns/ (click the Disable All) button.
from angular-dropdowns.
Just checked my package.json and found out this :
"name": "angular-dropdowns",
"version": "1.1.0",
Seems like i'm running version "version": "1.1.0", that might be the problem.
That was the problem, sorry.
from angular-dropdowns.
Related Issues (20)
- AngularJS 1.4.x support ? HOT 3
- Scrollable dropdown HOT 1
- conditional dropdownOptions HOT 1
- i18n support HOT 1
- Ability to focus on tab HOT 2
- click also triggers focus action
- Modifying dropdownMenu wrap element HOT 1
- support for npm? HOT 1
- Touch Issues
- Detect change event HOT 1
- Dropdown validation HOT 2
- Support for ng-class attribute HOT 1
- drop down is hang in IE HOT 3
- Clear dropdown HOT 3
- Bower or npm package HOT 1
- Use npmcdn instead of bower
- Css to the selected item HOT 3
- append to body option
- How I use Custom Templates HOT 1
- set icon programmatically HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-dropdowns.