You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This could currently be done by overriding the ViewStrategy classes getDefault method:
import{ViewStrategy}from'aurelia-templating';import{Metadata,Origin}from'aurelia-metadata';ViewStrategy.getDefault=function(target){varstrategy,annotation;if(typeoftarget!=='function'){target=target.constructor;}annotation=Origin.get(target);strategy=Metadata.on(target).first(ViewStrategy);if(!strategy){if(!annotation){thrownewError('Cannot determinte default view strategy for object.',target);}// Override this partstrategy=newMyCustomViewStrategy(annotation.moduleId);}elseif(annotation){strategy.moduleId=annotation.moduleId;}returnstrategy;}
Though it would be nice if this method hooked into some kind of global config option like defaultViewStrategy that we could override, rather than re-declaring the whole method
Currently I use the following to set the view strategy (view factory factory) of my view model:
I would really like it though, if I could do something like this instead
This basically creates a property on the module, named
view
, which acts as a module-global view factory factory.The text was updated successfully, but these errors were encountered: