Page 1 of 1

How do I access UI component in Typescript - ionic

Posted: Mon Nov 30, 2020 10:27 am
by maithili

Hi,
I want to change a component from Disabled to enabled on a button click
In the button click how to get access to the component.
getElementById does not work
There seems to be references to $scope variable in documentation but that is not reconised (Cannot find name '$scope')
Then there is reperecents of Appery.io() but that also is does not work.

How do you access UI components/get handle to it?

Thanks


Re: How do I access UI component in Typescript - ionic

Posted: Mon Nov 30, 2020 3:29 pm
by Serhii Kulibaba

Hello,

What Ionic version do you use here Ionic 1 or Ionic 4?


Re: How do I access UI component in Typescript - ionic

Posted: Tue Dec 01, 2020 8:23 am
by maithili

ionic 4


Re: How do I access UI component in Typescript - ionic

Posted: Wed Dec 02, 2020 6:23 pm
by Serhii Kulibaba

Please use the property

Code: Select all

[attr.disabled]

for that. You can use any boolean variable or expression here to disable/enable component


Re: How do I access UI component in Typescript - ionic

Posted: Thu Dec 03, 2020 7:37 am
by maithili

Hi,
So sorry.. did not quite understand your reply
[attr.disabled]??

If i have a button or input component.. how do I use this
say SubmitButton1

SubmitButton1[attr.disabled] =false.. or something like that??? That does not seem to work

The componentname is not getting recognised. How can I get handle to compoenent so I can change its attributes/value.

i also tired variations of this.Apperyio.get() but that does not work..
I could not find any documentation for this.Apperyio

So sorry if this a very simple and obvious thing. i am not able to resolve it


Re: How do I access UI component in Typescript - ionic

Posted: Fri Dec 04, 2020 6:15 pm
by Serhii Kulibaba

Please add it to the "Properties" panel of the component you want to disable/enable:

Screenshot_35.png
Screenshot_35.png (67.09 KiB) Viewed 1596 times

If you need to control it with the TypeScript - please use a variable instead of the simple Boolean value as you can see on the screenshot abow


Re: How do I access UI component in Typescript - ionic

Posted: Sun Aug 22, 2021 3:24 pm
by ahmethelal009

How do I Disable a Button Called "StartAgain" (=Component Name) whit type Script?(IONIC 5)

this .StartAgain.disabeld = true?


Re: How do I access UI component in Typescript - ionic

Posted: Sun Aug 22, 2021 3:35 pm
by ahmethelal009

I want also to disable a IONIC 5 Button.
I have added
[attr.disabled] with value to to the parameters of the IONIC5 button,

What will be the type script if I want disable or enable the Button called StartAgain (As COMPONENT NAME) .

What about this code: Will this code work?

this.StartAgain.attr.dsisabled=true??????


Re: How do I access UI component in Typescript - ionic

Posted: Fri Sep 10, 2021 10:59 am
by Serhii Kulibaba

It is not possible to use the component name to disable/enable the component. Please use only its property disabled as I shown above