I'm currently trying to build an analytics application using Javascript and angularJs.
However I'm having a few problems.
I just have two simple pages and one controller in each one. I tried to share data between these pages using a simple service. The first page is in charge of analyzing multiple csv files and building javascript objects, and the second to iterate through this data to display charts and tables.
However when I'm moving from the "anaylzer" page to the "displayer" page and since the JS files are refresehed, everything is flushed adn I loose the data I recorded inside my service...
I already have a look to a few storing modules like http://www.jstorage.info/, but the data objects I'm building are big (csv files are about 100 000 lines each...)
Do you have any idea ? Maybe I'm not using the right angular JS philosophy ?
Do not hesitate to tell me to put the piece of code I've written.
Thank you a lot in advance,
Angular is primarily tailored for producing single-page applications, but you could look into following alternatives for sharing data among few tabs (pages):
Local Storage - http://diveintohtml5.info/storage.html
File System API - http://www.html5rocks.com/en/tutorials/file/filesystem/
I have been using 1) with great success, but it's designed for storing small amounts of data.
angular is for single page application.
you should use ajax to pull your data from server.
Don't refresh your page.
there is a example how angular change view.
checkout https://docs.angularjs.org/api/ngRoute/service/$route
Related
How do you use those free AngularJS Dashboard Templates you find online?
I found many free angular dashboard templates.
They look nice, but I dont see documentation on how to use them,, some starting point for example.
Looks like you could use them to pull data from a database and represent it dynamically, but I dont know where to start in the most simplistic way.
for example, with this one:
http://startangular.com/product/flatlogic-angular-material-dashboard/
Start by merging your package.json and dev dependencies together, or using their project as the base, then you can do a lot in editing the partials in views/partials, and then for pulling data, you can implement an api into each of their controllers or pass information into each of the directives. There's no starting point for any data manipulation, it's more like a dashboard that you can send data into the panel-widget. This is only front-end stuff, so you must already have a location to pull data from.
Angular js is new in market so is there any advantage of using angular js with magento ?
If yes then anyone knows how can we use both in a single project ?
Angular is not new in the market, it´s pretty old already. Anyway, the benefit of using Angular (or another client framework) is that your shop can be a lot faster - instead of a page refresh for every click, you can load data/templates with Angular. For example, with a REST API. Meaning: you only load what you need and the server can handle more users.
There are many resources about this topic already, here´s a small list:
https://github.com/Wildhoney/Magento-on-Angular
http://www.webspeaks.in/2014/03/integrating-angular-js-with-magento.html
https://firebearstudio.com/blog/moa-magento-on-angular.html
http://www.neevtech.com/blog/2013/04/12/lightning-fast-magento-store-with-json-angularjs-and-magento-j-a-m/
https://www.reddit.com/r/Magento/comments/33mcgq/we_did_it_we_converted_our_magento_site_to_a/
Read through all those links and you will know why it´s good and how it can be done.
My application is salable. currently we identify 200 screen in my application.
In single page application we need to dump all the templates and js file in one request then initial loading takes more time to render page.
is there any standard way to handle this?
Simple!
Don't dump all templates & js file in one request. Use ajax to fetch them as & when required.
I personally prefer using requirejs
I have individual pages and initially I wanted to use angularJS because of data binding and the many other neat features. I also ended up using requireJS simply to help me manage my dependancies better as the list of javascript libraries I'm using is growing.
My question is using AngularJS with requireJS a no no for non single page web apps?
It's not a no-no. You can definitely use angular on non-single page apps. You just will lose a lot of the functionality - ie the stuff between "pages". You app will essentially be recreated on every page.
I've used angular for a multi-page site (basically a product search engine), with each page being separate. I used GET and POST to transfer stuff across pages, but ultimately, I wanted to use angular for rendering the content on the page because it's just neat and clean.
I am developing a simple website with few JSP pages. Each jsp does have a dynamic data that needs be read from XML before they redered on to the browser. Though MVC pattern such as Struts2 is more appropriate here, I don't want to implement it for a simple web application.
For this purpose I just want to implement FrontController Pattern which is sufficient for managing the jsp pages with few Helper Classes.
What I want is to have a Centralized Controller for all JSP pages. if user try to acccess any jsp page, then it should first go to the Controller. So I tried to implement a servlet with URL pattern "/pages/*.jsp" where /pages contains all jsp pages in webcontent.
The problem is, the controller is being invoked each time when there is a call for .jsp file, but when I try to disatch it to the jsp page(ex /pages/homepage.jsp) it goes into indefinite loop. It is obvious that each jsp page call will always comes to controler again.
So is there any other way that we can implement the centralized controller for this situation.
Thanks in advance.
I guess your only problem is that you need to read a XML file before each and request is processed.
If this is only the case than Filters are best suited.
But in case there are more that needs to be done and you really need a centralized control on all request than you can do anyone of the following: -
Struts (it doesn't matter that your
project is small or big, but using a
predefined and proven pattern is
always useful).
In your Controller put a mapping of
logical URL's with Physical URL's
and now put your mapping to Logical
URL's and not the physical URL's.