material icon indicating copy to clipboard operation
material copied to clipboard

Maybe add md-chips read-and-delete-only ?

Open JoachimR opened this issue 11 years ago • 22 comments

Since I have this use case right now I was wondering if it is a good idea to add this as a feature in the future.

Basically the user may delete chips but at the same time the user should not be able to add chips by just typing stuff and pressing enter as I have a custom form for that.

JoachimR avatar Jul 20 '15 09:07 JoachimR

Probably the correct thing would have been to separate user input from chips altogether and introduce a layered component which deals with a default input, custom user input, or custom user autocomplete, but that's probably too big a change and will break a lot of implementations (well, all). What we could do now, is add a bool property: md-no-input (or somesuch), that will suppress the default input - this would give the read-and-delete only behaviour.

typotter avatar Aug 10 '15 04:08 typotter

+1. I use chips to display list of contacts. The list is predefined, but it should be an ability to remove a contact from the list.

kamarouski avatar Sep 23 '15 15:09 kamarouski

+1.

peio72 avatar Nov 02 '15 11:11 peio72

+1

ydegtyar avatar Nov 13 '15 10:11 ydegtyar

+1

Pelu2k12 avatar Nov 17 '15 14:11 Pelu2k12

+1

TheRealBryon avatar Nov 17 '15 14:11 TheRealBryon

+1

Relatively easy to do right now if you want to write a simple directive to disable the child input element.

gdoerr avatar Nov 17 '15 22:11 gdoerr

How about the other way around? predefined list in which a user shouldn't delete existing items, but be able to add new ones?

Should I open this as a separate issue?

goldylucks avatar Nov 19 '15 12:11 goldylucks

+1

maxlegault avatar Dec 08 '15 16:12 maxlegault

+1

gkohen avatar Dec 08 '15 16:12 gkohen

+1

BBeauchemin avatar Dec 08 '15 16:12 BBeauchemin

+1

MarcBoissonneault avatar Dec 08 '15 16:12 MarcBoissonneault

+1

FrankTheTank9 avatar Dec 08 '15 16:12 FrankTheTank9

+1

steffi80 avatar Dec 10 '15 21:12 steffi80

+1

hitigon avatar Dec 15 '15 08:12 hitigon

Is there any way to get this behavior now, except of overloading and disable the input that way? To me it seems that read-and-delete-only should be the default behavior for chips.

Overhear8805 avatar Dec 15 '15 09:12 Overhear8805

Easy to do with little risk and no modifications to the library. Just add md-chips-disable-input to the md-chips element and you're done.

module.directive("mdChipsDisableInput", ["$timeout",
    function($timeout) {
        return {
            link: function($scope, $element, $attrs) {
                $timeout(function() {
                    var input = $element.find("input");
                    input.attr("disabled", "");
                }, 100);
            }
        }
    }
]);

gdoerr avatar Dec 15 '15 15:12 gdoerr

The delete-only should be related to #5799

devversion avatar Dec 29 '15 21:12 devversion

Another way is to use a custom input, like so:

<md-chips ...>
    <input disabled />
</md-chips>

zoladkow avatar Mar 01 '16 15:03 zoladkow

I have one md-autocomplete input and three md-chips and need to disable the ability to add a chip with md-autocomplete only.

HighAley avatar Apr 04 '16 21:04 HighAley