Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-2725

ngOnDestroy, ngAfterContentInit and ngAfterViewInit isn't called for site plugins

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.5.2
    • 3.6.0
    • Site add-ons
    • Hide
      1. Download the gapfill question type plugin and install it.
      2. Create a quiz with a gapfill question in it. You have an example in here.
      3. Edit the file question/type/gapfill/javascript/mobile.js.
      4. Inside the componentInit function, right at the start, enter this code:

        this.ngOnDestroy = function() {
            alert('Destroyed');
        }
        

      5. Clear caches in Moodle (this probably isn't needed, but just in case).
      6. In the app, login in that site and go to the quiz.
      7. Click to attempt the quiz and check that the gapfill question is rendered.
      8. Click back (to leave the quiz). Check that you see an alert with the text "Destroyed".
      Show
      Download the gapfill question type plugin and install it. Create a quiz with a gapfill question in it. You have an example in here . Edit the file question/type/gapfill/javascript/mobile.js. Inside the componentInit function, right at the start, enter this code: this.ngOnDestroy = function() { alert('Destroyed'); } Clear caches in Moodle (this probably isn't needed, but just in case). In the app, login in that site and go to the quiz. Click to attempt the quiz and check that the gapfill question is rendered. Click back (to leave the quiz). Check that you see an alert with the text "Destroyed".
    • MOODLE_35_STABLE
    • MOODLE_36_STABLE
    • Moodle Mobile 3.6.0

    Description

      Site plugins can implement ngOnDestroy, ngAfterContentInit and ngAfterViewInit, but for some reason those functions aren't called when they should.

      Attachments

        Activity

          People

            dpalou Dani Palou
            dpalou Dani Palou
            Pau Ferrer Pau Ferrer
            Juan Leyva Juan Leyva
            Albert Gasset Albert Gasset
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/Jan/19