javascriptdom-eventssingle-page-applicationdurandal

ViewAttached event is not fired


I'm using durandal master details sample which is using composition.I have a view model with some events defined in it,

 var ctor = function(name, description) {
        this.name = name;
        this.description = description;
    };
   

    ctor.prototype.activate = function() {
        system.log('Model Activating', this);
    };

   

    ctor.prototype.deactivate = function () {
        system.log('Model Deactivating', this);
    };

    ctor.prototype.viewAttached = function (view) {
      system.log('this is not called !', this);
    };

All the events except the viewAttached are fired. I can't find the reason here ..


Solution

  • Actually I was using the latest version of the Durandal fro the GithHub repository.After looking it to the composition module found that they have renamed it to compositionComplete. This works as expected..

     ctor.prototype.compositionComplete= function (view) {
          system.log('works!', this);
        }; 
    

    Edit
    After getting Durandal 2.0 released , in documentation we have the attached event instead of viewAttached