Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I've been working on a project where we are using bootstrap and kockout.js to handle the views but I'm noticing we're copy'ing a lot of the HTML.
We've tried some options like google closure and JQuery.load but we've had errors with both.
Closure couldn't compile because of bootstrap and Jquery load gave us CORS problems.
As an example, we would like to use "templates" for the navigation bar and for the user control panel that is on every page.
Do you guys know some frameworks that are compatible with our setup?
If you want to use plain knockout there is a template binding:
http://knockoutjs.com/documentation/template-binding.html
Or you can look for DurandalJS. This is a framework which uses Knockout as templating engine.
http://durandaljs.com/
If you use Visual Studio you can checkout the Hottowel SPA template of John Papa. This gives a initial setup for working with DurandalJS.
http://www.johnpapa.net/hottowel-1-1-with-durandal-2-now-available/
Another option you can do is looking in the source code for the template binding to see how the template is injected in the element. You could create a new binding based on the template binding with your own loading meganism.
After a quick bing I also find a nice blogpost about lazy loading templates, which is worth a look:
http://blog.vosnax.ru/2013/06/03/Knockoutjs-lazy-template/
You should try Angular in my opinion. It offers a simpler template structure than knockout and allows very easy JSON calls to web API's
http://angularjs.org/
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am using Ruby on Rails 4 and I would to effectively use the application.js file by stating in it some JavaScript functions shared between my application. For instance, I would like to attach data-* attributes to my HTML tag (as made here) and use those functions "the Rails way". However, since I am new to JavaScript, I do not know how to state functions in the application.js file and how to call those from within view templates.
There are some guides on the web where I can learn more about?
First off, you should only rely on the edge guides if you're using edge Rails (pre-release), because they might document features not present in the generally available package.
This is the same guide for the current Rails version.
Then, to answer your question:
The use of data-* attributes on HTML elements is not a Rails technique, and in fact it isn't related to any specific framework.
While it is true that your back-end (in this case, Rails) will need to decide what to write in those data-* attributes when it generates the HTML response, using them with javascript is something that happens on the front-end, and it's definitely not related to Rails.
In any case, if you are a complete beginner the guide you're reading (ajax and unobstrusive javascript) will only confuse you.
You should start with some Javascript tutorial and read about the asset pipeline to understand the role of application.js in Rails.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
please help me to find out what is the latest framework that fit for developing single page application. Thanks in advance.
Please be more specific when asking questions. :)
If your goal is to augment web-based applications with model–view–controller (MVC) capability,then I recommend you to use Angular js or Backbone js.
You can use Angular js http://angularjs.org/ .AngularJS is an open-source JavaScript MVC framework.
This tutorial http://www.revillweb.com/tutorials/angularjs-in-30-minutes-angularjs-tutorial/ is very good for beginners and it's very easy.
And Backbone js http://backbonejs.org/ is also a good framework.Backbone.js gives structure to web applications by providing models.this http://arturadib.com/hello-backbonejs/ tutorial is also a good one for starters.
If you are struggling to choose any framework please read this article http://readwrite.com/2014/02/06/angular-backbone-ember-best-javascript-framework-for-you#awesm=~oymdu8WAUkUbdV
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm working on a single page application and I'm referencing Angular in it. However, the only thing I am using Angular for is the routing (and ng-animate for animating transitions between partials) so that I can change views without reloading the entire page. I don't anticipate using anything else from Angular but I don't know that for sure, as this is my first SPA. I am concerned about things such as load times (especially for international users who aren't near CDNs) as well as security (no point in having potential vulnerabilities if I'm not using those features), etc.
Q: Is using Angular solely for routing overkill? Should I be using something more lightweight?
AngularJS is a framework use it only for routing it's like use a bazooka for a bug ...
I think you need a lightweight library.
The best choice for routing IMHO it's Sammy.js with mustache.js for templating if you need it.
http://sammyjs.org
http://mustache.github.io
Refer to this post :
Comparison between Sammy.js/History.js/Nav.js
Hope it Helps.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking to build a web app (online simple game) with javascript / HTML5 but I want a structured code.
I have do some research and Angular look like a good MVC framework.
http://angularjs.org/
Have you see other framework ? Angular is it a really good framework ?
Thanks
Edit:
Maintain javascript code is not easy and quickly becomes unreadable without an architecture that helps to develop properly.
I have a simple little web project, players are by team and have some kind of action that infuence the actions of other players.
I want a framework that allows to manage all data easily.
A little way to flex and AS3, ca would be to create the component and integrate easily into the html code.
Backbone js seems to be effective for the data binding with epoxy.
or http://docs.angularjs.org/guide/dev_guide.templates.databinding
I'll do more research because my question is too broad ...
I think this is a very broad question that simply choosing a particular library won't solve. AngularJS is great, but I think it's important to understand how to scale a javascript application. Here is a video of a presentation given by Nicholas Zakas. http://www.youtube.com/watch?v=7BGvy-S-Iag
Another good resource http://addyosmani.com/largescalejavascript/
Knowing these concepts will allow you to build an application that is capable of dropping modules in and out seamlessly. You will be able to change a module without affecting any other module because your program will be loosely coupled. Additionally, should you choose to switch from Angular to something else, this framework will allow you to swap the base library easily and without breaking very much of your code.
Also, using modules and a mediator will make your code easier to test. Testing is important in any non-trivial application. I hope this helps!
If you're looking to just quickly create a web server that can serve your javascript application, I highly recommend Rails. You can get a server up and running in just 15 minutes. Another good MVC framework is NodeJs with Express. Almost as easy to use as Rails and it's purely Javascript whereas rails is Ruby.
Here is a list of common MVC frameworks and you can choose one based on the complexity of you app and data models.
List of common MVC frameworks
if you really want to build a structured App using Angular Js Use the directory structure of ng-boilerplate
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Im looking into documenting the javascript code we develop and are looking for some good javascript documentation generators, does anybody have any suggestions?
We used to used ndoc to create documentation for our c# code and are looking for something similar to document our js code - ideally something that can be run from a command line.
thanks in advance!
You can use famous JSDoc-Toolkit for that.
JsDoc Toolkit is an application, written in JavaScript, for
automatically generating template-formatted, multi-page HTML (or XML,
JSON, or any other text-based) documentation from commented JavaScript
source code.
And yes it also has command line options.
JSDoc is an approach to generating documentation from commented JavaScript. There are many variations:
It was originally implemented in Perl.
JSDoc-Toolkit ported it to JavaScript, but requires Java as it uses the Rhino JavaScript engine written in Java.
Several people have ported it to run directly on the node.js JavaScript engine/platform, e.g. node-jsdoc-toolkit.
dox also runs on node.js, it combines JSDoc-like tags and markdown markup but requires a separate templating engine(as used on Stack Overflow and github).
All run from the command line. Choose according to your tooling preferences. I like node.js for its speed and all-JavaScript-all-the-time feel. The DailyJS "Let's Make a Framework" post on writing documentation describes these and other tools; unfortunately dox was radically overhauled to just output JSON structures since that was written.
https://stackoverflow.com/q/1221413/1162195 mentions other JavaScript documentation generators.