Ionic 5 - Creating Theme Switcher (light and dark) using Angular

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • In this video, we will take a look at how we can create a manual theme swither toggle that switches to light and dark theme using Ionic 5 and Angular

Комментарии • 39

  • @sriz21
    @sriz21 Год назад +1

    Thanks!

  • @kaniwarhannan5483
    @kaniwarhannan5483 4 месяца назад

    hello do you have a way to do it on react instead of angular please?

  • @weixiangng8279
    @weixiangng8279 Месяц назад

    Hi if I want to make the app stays light theme eventhough my phone is set to dark theme how can I achieve that?

    • @mbaljeetsingh
      @mbaljeetsingh  Месяц назад

      You might want to save the theme state in the local storage or any other persistent storage and then read the value from there.

  • @merenelresearch8775
    @merenelresearch8775 3 года назад +2

    Great, thank you. I actually just needed to place the dark as default so I just set in index.html Thank you very much!!!

  • @jensuwebecker6923
    @jensuwebecker6923 4 года назад +4

    Wow, that was easy. I have a feature request for you: Please add your voice as stereo sound next time. That would be great!^^

    • @mbaljeetsingh
      @mbaljeetsingh  3 года назад

      Thanks, Forgot to change mono to stereo, will try to remember next time

  • @ferduno5629
    @ferduno5629 4 месяца назад

    Thanks mate

  • @chiefnarx
    @chiefnarx 3 года назад +1

    Great video!
    This didn't work for me, though. Don't we have to define the "dark"??

  • @brunorodrigoramoslamadrid6884
    @brunorodrigoramoslamadrid6884 4 года назад +2

    how do i keep the option selected? When I refresh the page It turns back to light theme

  • @SushantRawale
    @SushantRawale 4 года назад +2

    Thank you for the video, it's very easy.
    Could you please make video on sample page with login and restricting user to go back to login page from home page and vice versa?

  • @martinberit3558
    @martinberit3558 2 года назад +1

    Thanks a lot, Baljeet - excellent explaination. Just one question: What do we gain by using the Renderer2 ? - it worked well without it...

    • @mbaljeetsingh
      @mbaljeetsingh  2 года назад +1

      If you do SSR in the app, it might not work with direct Dom manipulation.

  • @likhileshsuryabhanbalpande531
    @likhileshsuryabhanbalpande531 2 года назад +1

    Very helpful! Thank you!

  • @mayankkataria7080
    @mayankkataria7080 3 года назад +1

    You saved my day. Thanks alot!!!

  • @musthagmohamed8175
    @musthagmohamed8175 3 года назад +1

    it does not work now. SAD...

    • @mbaljeetsingh
      @mbaljeetsingh  3 года назад

      It actually should, what issue are you facing.

    • @musthagmohamed8175
      @musthagmohamed8175 3 года назад +2

      @@mbaljeetsingh no errors... Everything works but does not change color

    • @prashantkumawat2070
      @prashantkumawat2070 3 года назад +1

      @@musthagmohamed8175 Yes same issue at my side

  • @jfmmhonca
    @jfmmhonca 2 года назад

    Thank you for the video, it's very useful.

  • @Besthooloo
    @Besthooloo 3 года назад

    Renderer2 doesn't support directly in a service so it needs to be defined the RendererFactory2 injection for working with Renderer2 otherwise it gets back a null error exception.

    • @jared4670
      @jared4670 3 года назад

      private renderer: Renderer2;
      constructor(rendererFactory: RendererFactory2) {
      this.renderer = rendererFactory.createRenderer(null, null);
      }

  • @munamurad4266
    @munamurad4266 3 года назад

    dose it work with a blank project not tabs ?

  • @mikhailpetrunenko6472
    @mikhailpetrunenko6472 2 года назад

    Thank you very much!

  • @maharshigohel1936
    @maharshigohel1936 2 года назад

    Thank you so much

  • @mohanedbenmansour5927
    @mohanedbenmansour5927 3 года назад

    thank you for this great tutorial

  • @whyneil
    @whyneil 4 года назад

    which extension do you use for the i-item type of autocomplete?

    • @mbaljeetsingh
      @mbaljeetsingh  4 года назад +1

      Search for ionic snipppets by fivethree

  • @chentongliew3512
    @chentongliew3512 4 года назад

    thanks!!! this video helps me a lot

  • @angadsaluja3489
    @angadsaluja3489 4 года назад

    Thanks Jatta! Khich ke rakh!

  • @nishanthasanjeewa4442
    @nishanthasanjeewa4442 4 года назад

    is it works?when reload the page?

    • @mbaljeetsingh
      @mbaljeetsingh  4 года назад +2

      By default no, but you can save the toggle state in the local storage and then check for its value.

  • @johngeronimo8821
    @johngeronimo8821 3 года назад

    Is the state will be saved if I reload the page?

    • @mbaljeetsingh
      @mbaljeetsingh  3 года назад

      Not currently, but you can use local storage for that

    • @munamurad4266
      @munamurad4266 3 года назад

      @@mbaljeetsingh how ? please let me know

  • @iqbalsingh6311
    @iqbalsingh6311 4 года назад

    Very informative video