Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm currently working on a web page where you can add many different "machines" and then specify certain things about each one.
My original thought was to create div's for each machine (which would contain common elements like "name", "operating system", etc), and then change the IDs according to the names. That being said, is this really the best approach? Is there some way to use javascript/jquery to essentially make classes?
I also read briefly about some javascript template libraries like mustache, but did not get too into them.
Not looking for you to write the code for me -- just wondering how I should approach this
Yes, you can use an array of JSON objects for this.
A Javascript library that supports model binding like AngularJS or Knockout can make displaying all the "machines" very easy with their foreach functionality.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
In many languages, to find cosine, you use cos(x). But in JavaScript, you must use Math.cos(x). Why doesn't JavaScript spare us the 5 characters in Math., both making it easier to type and easier to read?
I have tried to Google this multiple times, and found no answers. Is there any practical reason for this that I have not yet found?
So far, there are three reasons I can think of:
The creators of JavaScript want to ensure that the math functions do not coincide with other functions users create (Like a function called 'cos()` that calculates, say, cosecant)
The creators of JavaScript thought that Math would make the code more readable
The creators of JavaScript perhaps didn't want any functions that have window as a parent (Though alert and prompt make this unlikely)
To hold the math functions without polluting the global namespace.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I want to know that in order to make a dynamic search application which looks through all the collections and gives the users the ability to use facets, collection facets, pagination, sorting etc what should be the right approach?
I found two functions for this: search:search, and cts:search. Which matches my needs best?
search:search is built on top of cts:search (as well as other APIs). They’re designed to work together. You should start with search:search, though. It is designed specifically for your faceted search use case and includes many conveniences and best practices that might not be obvious with the lower-level APIs, for example, concurrent facet resolution and pagination. If you need to do something more sophisticated than what search:search provides out-of-the-box, you can call out to other libraries.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a lot of elements that are created on the fly from data received on the server, as JSON. To create these elements a lot of HTML is going inside my JavaScript code. Is there any solution to this problem? The JavaScript code is polluted and writing HTML tags becomes harder and less maintainable.
Templating tools such as handlebars, mustache and dust.js were designed to solve this very problem.
Ember.js is another alternative that allows you to remove HTML from your JavaScript through their templating tool called HTMLBars.
Check it out!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I was wondering if anyone can help in choosing a framework as this is my requirement:
We have to use our own model, we have an internal JS Database that is our model that sits inside the browser and syncs with the remote server, so this is a deal breaker as we have to use our Model and not the framework's... We will have to manually handle any mapping between GET and SET any data from and to, the Model... (can I even use a JS Framework with this requirement)
We will use Bootstrap for the UI so we don't need any Framework that comes with UI such as Ext JS, we need pure framework
We would like (but don't have to) keep using jQuery. This is not a deal breaker, but if we can continue and use jQuery it will make our learning curve shorter.
We need good Routing capabilities including the ability to change the actual View (i.e.: show hide DIV of current selected route) and not just fire an event when new Route is selected.
Binding and Templates would be a plus (I believe all good frameworks have it)
A light Framework would be better, but not a must.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to model my javascript object using visio, visio doesn't support javascript data types.
Then I start thinking, how do you desing model your javascript code?
Cheers
In the past, I've used Open Source tools like Dia and just fudged the data types where needed...
It's enough to get the idea across, but you're definitely not going to get anything even close to code generation from it.
I prefer Object Oriented design - even for JavaScript - so I suggest Rational Rose. I like some of the features of OO (e.g. encapsulation and abstraction) and like to add some discipline to a potentially undisciplined environment - especially when working with developers new to JavaScript. Rose meets my needs.