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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5.2
    • Fix Version/s: 3.6.0
    • Component/s: Site add-ons
    • Labels:
    • Testing Instructions:
      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".
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Sprint:
      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

            Assignee:
            dpalou Dani Palou
            Reporter:
            dpalou Dani Palou
            Peer reviewer:
            Pau Ferrer
            Integrator:
            Juan Leyva
            Tester:
            Albert Gasset
            Participants:
            Component watchers:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Jan/19