-
Notifications
You must be signed in to change notification settings - Fork 50
Does it work with RequireJS? #8
Comments
Hi, I get an undefined in the console when i type 'ko.dataFor($0)', also an undefined for contextFor. I have never used dataFor before, i don't suppose you know what could prevent it from working? I've googled it and had a read of the docs but nothing obvious is coming up as to what i have done that might break it. Anyway cheers for the quick response. On 30 May 2013, at 11:39, timstuyckens notifications@github.com wrote:
|
I'am not 100% sure but I think it has to do something with your custom templating. But as long as the default knockout function 'dataFor' not works, the extension will not work. Wild guess for a solution: He has a fiddle: I tested the knockout extension on this url : http://fiddle.jshell.net/rniemeyer/3598P/show/ and it worked. So I guess you can compare your templating with that from Ryan and maybe it will give a solution. Best luck, Tim. |
I based my own templating engine on Ryans older article about template sources, its interesting to see how his approach with amd plugins differs form my own, where I load the external templates using requireJS in the view model and he defines their location in html templates but they both end up in the same place (a central repository for viewmodels) his way is just nicer (i think). It is also interesting that your plugin does work on that fiddle as its quite similar to how i do my own templating. My brother has also verified that your plugin works on his own project and he uses the external template engine as mentioned in Ryans post. I am definately doing something weird it just a case of figuring out what :-) i will keep digging and let you know if i work out what the problem is cheers On 30 May 2013, at 12:09, timstuyckens notifications@github.com wrote:
|
Closing the issue because the problem is not in the plugin. |
I have a similar setup to the one described in this issue, but the outcome when using the (what would be awesome) plugin is significantly worse. Critically, with the plugin installed when I open the Developer Tools the page/tab locks up and CPU usage for it goes to 100%. When I disable the plugin the Developer Tools runs normally. Once can see under the KnockoutJS title in the Developer Tools the single line When the plugin is installed, $0/etc is undefined. Without the plugin This may or may not be the issue set out above, but nevertheless the setup is similar enough (coffee script, custom templating, RequireJS) that the cause may be similar. There are lots of potential sources - I would be happy to assist. |
Hi, Is it possible to provide a small page that reproduces the problem? https://github.com/timstuyckens/chromeextensions-knockoutjs/wiki/Contribute |
Thanks Tim - I will have to debug since the page is a bit too big to decompose. I am on a deadline until th 18th or so but hope to file an issue before or around then. Cheers 🍻 |
I tried your plugin and verified that it works fine on the knockout website's live examples but it doesn't work with my project.
My current project uses Knockout (obviously), RequireJS, CoffeeScript and a custom Templating engine i have written (that allows templates to be loaded as text by RequireJS). I think one of those three may be preventing your plugin from parsing my view models but am not sure which.
Does the plugin look for a script tag that contains a view model? if so i reckon that might explain why it cannot find my viewmodels as they are all loaded as dependencies with RequrieJS.
I don't think the issue would be CoffeeScript because by the time the browser sees my code it is already compiled into JS (by RequireJS).
Perhaps my non standard templating engine is causing issues, although all it does it centralise where templates can be found:
Any ideas? I would love to be able to use your extension for my projects.
Here is a screenshot which shows my DOM and your plugin, it shows how i have nested view models and templates:
The text was updated successfully, but these errors were encountered: