How to synchronize angular apps with togetherjs - angularjs

I am trying to use togetherjs to make a live help feature for an angular web app. I put the together code in and it works on a basic level. You can see each other's cursors and chat etc. The problem is that none of the angular state data syncs. So when someone navigates to a different route the others don't follow them to the route. Is there a way to fix this? I have seen another question like this on SO but it hasn't been answered and I don't have enough reputation to do anything but answer it and I am seeking the same answer. Any help is much appreciated.

Related

How can you build React on top of Drupal?

I've never used Drupal, but have been looking up tutorials online. My client would really like the adaptability of React and to have more flexibility in terms of design. I could make my own database and React app, but I have not studied security (I'm a team of one, so no one for security on my end, either). Security and access to a content management system was the main reason we decided to go with Drupal. However, I would still like to be able to code in React/something I'm familiar with to produce a site I am proud to say I made.
I've been Googling and Youtubing tutorials and help, but not having anyone to ask specific questions is making this difficult.
If anyone knows of a relatively easy way to build a React app on Drupal, I would really appreciate the advice. Or if there is a better way I should go about beginning a project as I've briefly mentioned above, I would also be open to that. Thank you in advance and sorry for the long message!
What you are asking is quite broad in concept and not easy to answer in just one answer post. Try to look for Headless / Decoupled Drupal.
https://www.acquia.com/drupal/decoupled-drupal
What this essentially means is that all the services and the content management are handled by Drupal while the core user experience or the way the site is displayed in a browser is controlled via a JavaScript framework such as React.js or backbone.js. This is achieved via Drupal’s RESTful API service.
Hope this helps.

Understanding Ionic [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am very new to ionic and still trying to learn. Few things I can't get a direct answers on this, hope for some help me. I went through few tutorials are articles, have an basic idea of ionic.
I am trying to develop a "group app". the group has 50 members.
I wish to publish event listings in the group app. Updating will be done
every week. So i can't exactly recompile this into apk whenever I do updating.
Also, I noticed ionic has a template that has login page. Where exactly does the username database stored?
If i need an admin section within ionic app, will it be possible? Whats the recommended method to do this?
If possible, I want this to do without any cost at all. I have a normal wordpress website that uses mysql database.
please help. thank you.
I am very new to ionic and still trying to learn. Few things I can't get a direct answers on this, hope for some help me. I went through few tutorials are articles, have an basic idea of ionic.
it is apparent from your questions, you've been reading recipe and not tutorials. They may have been labeled tutorials, but they were not. You are asking way too many questions, and the topics are too broad (wide).
To answer your question, in order
I am trying to develop a "group app". the group has 50 members. I wish to publish event listings in the group app. Updating will be done every week. So i can't exactly recompile this into apk whenever I do updating.
Your conclusion is based on faulty logic, and not understanding how Cordova works.
Also, I noticed ionic has a template that has login page. Where exactly does the username database stored?
Username and password storage is your issue, not Cordova's.
If i need an admin section within ionic app, will it be possible?
Yes.
Whats the recommended method to do this?
That's up to you. But understand you will be building it your self, likely from scratch.
If possible, I want this to do without any cost at all. I have a normal wordpress website that uses mysql database.
It is possible, but you will likely want to use a REST API to talk to the mobile App.
As you can see, my response appear to be vague, but that is because your questions are too broad.
I recommend reading this FAQ
Top Mistakes by Developers new to Cordova/Phonegap
If you have any further questions, I recommend following up on Google Groups Best of Luck.
I am trying to develop a "group app". the group has 50 members. I wish
to publish event listings in the group app. Updating will be done
every week. So i can't exactly recompile this into apk whenever I do
updating.
you can do this using ajax requests to server to get new events
and this is pretty easy by ionic using angular JS but it just need some time to try and read on how to make a restful ionic application
this will help you get the events from the database when the application opened
Also, I noticed ionic has a template that has login page. Where
exactly does the username database stored?
online database, just ready my answer to your first question
If i need an admin section within ionic app, will it be possible?
Whats the recommended method to do this?
yes it is possible but it is not recommended to do it in your public app
better to make web app for that
If possible, I want this to do without any cost at all. I have a
normal wordpress website that uses mysql database.
it will cost you nothing and you can use the MySQL database of your website
Good luck, you can make it, it just need some time and some searches

Login with AngularJS [closed]

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 7 years ago.
Improve this question
I need to implement the following feature: whenever somebody comes to the site, he sees the login form and if he didn't logon correctly, any other url should show him login form.
how can I do this?
I have the project I inherited and only starting in Angular, so I have no idea where do I change the first page I show and how do I block unauthorized users from accessing other urls
To keep the explanation as basic as possible angular works in the main index.html file by using "controllers" to explain to the client browser what to do. Somewhere in your folder hierarchy should be a folder named "partials" , "templates" , "views" ,or something similar. It should contain a bunch of small .html files. Those files are swapped using AJAX embedded into angular. There should be an html element tag that contains an attribute "ng-app= "whateverYourAppsNameIsHere" within the opening element tag, anything in between this tag is "angular."
Angular seems complex at first, but once you keep at it it gets much easier. Everything within the ng-app attribute is powered in your JS files, and there's some really good free resources out there, including codeschool which has one, and angular. Google, hosts their own "phonecat app" which explains all the basics in pretty good detail in a walk-through tutorial with code snippets provided for when you can't quite figure it out. Make sure you use this link though [Google:Angular - Go to "tutorial"] (https://angularjs.org/) There is currently an Angular 2.0, which is written in TypeScript(short hand JS) found at FYI Only: Make sure you're not on this domain Know this exists in the event you start liking TypeScript, but I'd recommend sticking with plain angular until you're comfortable with it.
Okay, so that's a brief splash of what's what to find your files, and hopefully help you grasp any answers a bit better. At the very least those are 2 really good resources to start learning Angular from.
For your direct question "How do you manage users being logged in, or sending them to a page." There are many ways to perform that task, so I'll give you guidance on how to best learn it in my opinion. 1) Review "ng-if" which you can use to display/not display a page section (or as you asked re-route to a login form if not verified) People typically seem to use a "router" for Angular, Angular-UI is a fairly well recognized one and you can find it here: npm angular-ui-router. You can also verify someone on the back end when they call out to the server for page updates.
So I know I didn't directly answer your question, but the links I sent you will more than answer your question and also give you some guidance where to start learning/looking for resources from. If you're not yet familiar, I would recommend building/maintaining your app in Yeoman if you have not done so already. Yeoman and [Yeoman - tutorial] (https://www.youtube.com/watch?v=gKiaLSJW5xI) <-- This guy is AMAZING for tutorials, and he's very reassuring when you're scratching your head feeling overwhelmed with coding things.
Hope it helps, that's 3 years worth of resources touted out in 1 question response. Happy Coding! ;)

So many missing pieces. Where to look next? [closed]

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
Learning angular is a pretty frustrating process. I've just started the journey down this endless road a couple of weeks ago. I've gone through the official tutorial on the angular website, watched the first 40+ videos on egghead.io and read through several other tutorials and examples. I'm new to angular but have a good amount of experience with javascript, jQuery, and knockout, but even after all of the research and examples I've gone through, I still can't piece together even the simplest angular app in a real-world situation.
The problem is that most of these tutorials and examples try to show all the different parts of angular, including controllers, directives, filters, services, $http/$resource, routing, animations, etc.so you end up with this one or two controller app that doesn't have any substance but it incorporates the basics of all of these features. Now, strip away all of the features that aren't really needed for a simple app like $resource, routing, and animations, and add substance to the business logic and data management, and you quickly can see how many holes exist in these tutorials.
For example, a tutorial will show how you can share data between controllers using services. It will go over creating the controller, and using a service to get the data from a server using $http or $resource. Then it will show that even though the request for data is asynchronous, there is rarely a need for callbacks because the data-bindings will just be empty until the data arrives and then magically filled in. Now you have a reusable service to get data in all of your controllers.
Wow! everything is so simple and clean, and it just works! Angular is awesome! Then, of course, when you go to write an actual app that needs more than one controller, and the controllers all depend on the same data, and you add something called "business logic" that is also shared and uses this data, you immediately realize things aren't so simple.
First of all, as soon as you add business logic that has to use the data from the server (like with any real app), your clean code with no callbacks is broken. You now have to implement callbacks everywhere, because you have to wait for the data to arrive before you can use it. Second, prototypal scope inheritance becomes unreliable because you don't know if the data from other controllers has loaded yet or not. Worst of all though, there is nothing in these tutorials about how you are supposed to keep the data in sync between controllers, and with the server. If the data is modified in the scope of one controller, somehow all of the other controller scopes need to be updated as well...
These are just some of the complexities that are introduced even with a pretty simple app that doesn't even use routing. I'm trying to make a simple calculator that doesn't persist data, and I am stuck with all of these problems and questions and can't find any real solutions.
Can someone please point me in the right direction of a good tutorial, example, or book that will fill in these missing holes without getting into complex parts of angular that my app doesn't require?
Thanks in advance and sorry for the rant, this has been very frustrating :/
I am far from being an angularJS expert, I am actually in the process of learning too. However, we are almost done with our first angularJS MVP at work so maybe I can share some of my experience. Here are a few patterns I learnt
Your controllers should be minimalist and call services and factories.
Controller actions are triggered by $emit and $broadcast which is what keeps everything in sync. I have controllers with just a list of $scope.$on('onCustomAction',function(event,params){ $scope.myObject.doSomething(); }). Ideally, it should be a minimalist list of those.
In ng-click, you should have methods like myObject.fancyMethod() where myObject is part of the '$scope`.
Put small pieces of reusable html that have their own little controller in directives. I am quite late on that but I am starting to have a few.
Use ng-include for large pieces of html that you need to move around (ie: modal windows, main content, sidebars etc).
Remember, if it's not in the $scope, it might as well not exist.
Services can call other services and can be used for singletons and instanced objects. They should be the meat of your code.
Hope this helps. Feel free to argue each of those items.
As someone who was experiencing the same type of angularjs frustration. I get it. What helped me immensely was Jeremy Howard's 4 part tutotial, "Angularjs End to end web app in under an hour". It uses ASP.net but I am sure most of the back end examples would be easily reproducible with any other framework.
Here is a quick and dirty laundry list of why I found this useful.
Example is a Todo CRUD app that could be used as a template for most other web apps.
The videos move at a reasonable pace and are broken down into logical functional areas.
Jeremy uses some of the techniques you described above that are in other videos such as promises, directives, factories, services, link functions, controllers, etc. However, the examples he uses do have substance as they work within the context of the todo app.
Lastly, it becomes clear in watching Jeremy going through his tutorial that being very organized in how you structure your back end will make your front end angular app so much better and powerful. Think separation of concerns to a whole other level.
I could go on and on but one thing I can say, is that Jeremy's tutorials not only made me better at angularjs but made me better at being a full stack developer.
Do yourself a favor and check it out. You won't regret it. Good luck.
Here is a nice tutorial on data model dealing with your problem:
"Worst of all though, there is nothing in these tutorials about how you are supposed to keep the data in sync between controllers, and with the server. If the data is modified in the scope of one controller, somehow all of the other controller scopes need to be updated as well..."
http://www.webdeveasy.com/angularjs-data-model/

gae-boilerplate documentation

In my search for a good social login package for App Engine, I am giving gae-boilerplate a try. But I find there is no documentation except the readme file, which I think it is not enough at all.
I have many questions, among them:
Should the boilerplate be used as a library or download and modify as needed?
How should the boilerplate be updated?
What does each model do?
Where should my templates go?
Should I have a different routes file?
Should I derive my Handlers from BaseHandler?
In general, what things should I implement in my pages? For example, I found out that I have to include a csrf_token in all POST requests. It would have been nice to know this in advance, and the many other things that I'm having to find out along the way, and which I implement without being sure if I'm supposed to be doing that.
And some more...
My biggest problem is that Social login is not working, and I feel this boilerplate is a big monster with which I don't know where to start. To make things worse, it is hard to debug social auth from any machine that is not the production one. Thats why I'm desperately looking for some docs.
I have not found anything in SO, and I guess there must be more people in my situation. So, any pointers to documentation that could help to understand gae-boilerplate a little bit better would be very appreciated.
EDIT: I switched to gae-boilerplate in a site that I had previously working. Maybe most of my problems come from the way that I have tried to integrate gae-boilerplate and my existing site. As a result I have tried to treat gae-boilerplate as a library, and keep my own templates, handlers, static files and such.
Thank you guys!
EDIT 2: After trying other options, I have to say that I am very happy with gae-simpleauth. It works really well, and Alex's support is superb.
I will try to answer most of your questions below:
Should the boilerplate be used as a library or download and modify as needed?
You can modify it as needed based on your specific requirements.
How should the boilerplate be updated?
What do you mean?
What does each model do?
User and SocialUser are pretty self explanatory. LogVisit and LogEmail are used for auditing purposes.
Where should my templates go?
In the templates directory
Should I have a different routes file?
No, you can use the existing file for all your routes.
Should I derive my Handlers from BaseHandler?
It't not mandatory but I would recommend to do so. BaseHandler is very handy and provides a lot of good stuff.
In general, what things should I implement in my pages?
What exactly do you mean?
In general, you can use gae-boilerplate as a reference on top of which you will built your own project. Study the code step by step, try to figure out what is the purpose of each file and library used and how they work together. This way you will gain good knowledge of a lot of things like jinja templating, oauth2, etc.
Hope this helps.

Resources