I am creating a single page application using ASP.NET and sammy.js, where the Home / Index view Apart from this, all thoughts are presented as partial thoughts so that Sammy can swap the main body material back with partial visualization.
I am using the given example, and hopefully everything is fine.
Similar to the above example, in my Home / Index page, I am known as routing routing.js, which wraps the Sammy function call to parse the MVC route:
< Pre> var routing = function (aparat, contents selector, default root) {function getrrfromhash (hash) {var url = hash.replace '# /', ''); If (url === appRoot) url = defaultRoute; Return url; } Return {init: function (samy} (content selector, function) (this.get (/\#\/(.*)/, function (reference) {var url = getUrlFromHash (context.path); context.load (Url) .swap ();});}). Run ('# /'); }}; }
After implementing the jQuery functionality on the new rendered content, the content swap is completely completed after I need to call the callback function. My dilemma is that I am Sammy . I do not choose any option from JS Docs, nothing happens to run a callback after the content is swapped.
I have all the following (all the "valid" ways to pass a callback according to Sammy.js docs):
content.load (url) .swap (pageload code (url) )); . Content.load (URL) .swap () onComplete (pageLoadScripts (url)); Content.load (url) .swap () then (pageLoadScripts (url)). . Content.load (url) .swap () next (pageLoadScripts (url)); . Content.load (url, pageLoadScripts (url)) swap ();
and even
content.load (url) .swap (); PageLoadScripts (url);
The page is loading in every case, which closes the content before swapping it. Any ideas or ideas have to do differently?
This is a bit of hack, but it works. Inside the Sammy initialization function, I added the following override to the swap function before override the function:
this.swap = function (content, callback) {var reference = this; . Reference $ element () HTML (content). PageLoadScripts (hashedUrl); };
FWI, I still can not do anything except 'undefined' callback, even in this override function.
No comments:
Post a Comment