2 AngularJS apps on the same website, multiple pages - javascript

I am trying to implement this AngularJS/Bootstrap Typeahead app and also use AngularJS for search functionality as well. I have the Typeahead implemented and working, however I can not seem to figure out how to implement 2 AngularJS apps on the same website...?

The first comment really helped because I didn't fully understand AngularJS, was just learning at the time. The first comment helped to realize my misunderstanding and gave the "light bulb" moment of just having 2 separate modules to include the functionality that I needed.
AngularJS - being modular - is great! You can really build capable apps using it.

Related

Laravel and Angular(JS), where to start with Angular?

I'm a software engineer and want to learn developing web applications with PHP and JavaScript. I'm familliar with C#, object oriented programming and working with frameworks.
So i decided to learn directly creating an web application based on a framework (Laravel, as we work with this framework on my work also). I start understanding how the framework works and as programming is not new for me i also understand the basics of PHP.
For the front-end i want to use Angular JS as i heard a lot of positive things about it. During my research on Google about Angular and Angular in combination with Laravel i read that we already have Angular V2 and V4.
I have a few questions about this:
What is the best version to start with? This because i heared the
good things about V1 (and the combi with Laravel), but V2 and V4 has
a complete other concept? I'm a bit confused if it has the same
purpose and if it is still a good approach to combine the newer
versions with Laravel?
I can find how to combine Laravel with AngularJS(1) and how to structure the project, but cant find a good tutorial or explaination how to combine/structure Laravel with
Angular 2 or 4. This also confuses me.... Are the newer versions not
a good combination with Laravel anymore?, Angular just uses Json
API's so why not? or are i'm wrong.
What i found about Laravel and the newer Angular versions is that it is a no-go to use both in 1 project. The advice is to use 2
different projects? I do not understand why as i can still make them
independed from eachtoher in 1 project by a nice folder structure.
So if this is true, what is the reason behind?
If it is no problem to combine both in 1 project, i prefer to do this. But what is the best practice to add Angular into the Laravel project? especially for the folder structure? Is there a tutorial which describes how to use these 2 frameworks in 1 project?
I hope that someone can give me a "kickstart" how to start with increasing my skills.
I would suggest using Vue.js instead if you are familiar with new Laravel 5.x. It is supported by default and plays together pretty good.
https://learninglaravel.net/topics/vuejs
In my previous projects I used Laravel 3/4 + Backbone.js. Backbone, to me, is much better then diving into a full framework that your entire structure ( html + js ) depends on multiple custom tags etc. Backbone gives you a better approach on that case that you can use it partially in some modules etc or you can build your entire layout with it.

Recommendations for a web application with Laravel

Im creating a web application with PHP (Laravel 5.) and currently AngularJS (1.). There are some components of the website that i want to build with Angular. For example a Form Generator. A user can click buttons and define which kind of field he/she would like to create. After that, the user can implement it on his website and receive submissions on it. This can be a small app build with Angular.
Currently Angular 2 is a R.C. version, which can be released soon. To keep myself triggered with the newest techniques, i started to explore it a bit and noticed the TypeScript with compiler which runs behind the public(_html) of a application.
Lets split my application in URLs to make my question simpler:
www.domain.com/form-generator -> Uses the script: /angular/form-generator/mainModule.js
www.domain.com/easy-importer -> Uses the script: /angular/easy-importer/mainModule.js
www.domain.com/my-other-small-app-> Uses the script: /angular/my-other-small-app/mainModule.js
Is it possible, efficient and recommendable to create small modules/apps that are loaded on base of the application i build instead of loading them all together? Is Angular 2 recommendable for this or should i consider jQuery and keep Angular 1.*?
If you're looking for a front-end framework to use with Laravel, I reccomend vue.js. Taylor Otwell, the creator of Laravel, has indicated that vue.js is his front-end framework of choice.
Keep in mind, you can use any front-end framework you want. Research what's out there and pick based on your needs. Laravel is not tied to any single front-end: it's your decision.
I only suggest vue.js because it's been adopted by a significant portion of the Laravel community. That community can help you out when you get stuck, and have resources to help you get started. Personally, I watched the Laracasts by Jeffrey Way to get up to speed.

Angular js + Rails good idea?

I have been using rails as backend and some basic css, js for frontend. I am the only one in dev now, but I thought it's better to separate frontend/backend for later when someone else joins as frontend. I was googling for a bit and figured angularjs might be a good combination.
However, I don't quite get other benefits of this combination(rails + angular) other than making separating front-end jobs. What are the other benefits of having angular in rails framework or any cons?
Thanks a lot!
======== EDIT ==============
Sorry that my question was too broad in some way.
In short, I was wondering if there are any reason why angular is such popular combination with rails. Compared to just using rails for everything(front+back), what are some benefits of using angular on the front end + rails backend-api? (speed, simplicity, DRY-er code......etc?).
I just started googling angular for several days now, and before actually getting into it, I wanted to hear from people having experience in it. Thank you.
Angular + Ruby on Rails is a very popular combination. Use rails for api endpoints and angular to retrieve and display data. You can also do most pages with rails and only some components with angular depending on how complex your pages need to be.

jsPlumb best javascript MVC framework to associate with

This is an opened question,
In order to make the best choice for my project, I need to know what is the best MVC javascript framework to couple with jsPlumb 1.5.5 (jQuery) to do the easiest and the most robust implementation in order to handle all business logic and a clean code division.
My choice will be made regarding these well-known frameworks :
1) AngularJS
This Stack post refers to a way to separate jsPlumb graphic code with AngularJS controller code (using a custom AngularJS service to handle jsPlumb logic) :
Using AngularJS and jsPlumb (use jsPlumb functions in AngularJS controller)
And there is a simple implementation example here :
https://github.com/mrquincle/jsplumb-example
2) Ember.js
I found this Stack post, referring to an issue (solved) :
Using jsPlumb in an Ember.js Application
3) Backbone.js
I only find one sample very very ligthweight..
I got some informations about these 3 frameworks thanks to this helpful link :
https://sporto.github.io/blog/2013/04/12/comparison-angular-backbone-can-ember/
I need to know what should be the best approach to make an heavy and clean front-end full-js application to achieve this kind of product :
http://equationmap.com/322/#.U1d8gfl_v-1
From my point of view, AngularJS is the best choice today, but I want to understand if it's possible with this framework, to add some new HTML elements on the fly (jsPlumb elements creation) and to bind them an AngularJS business logic ?
For your requirement, I would suggest you to try emberJS rather angularJS. Because(Source):
"Angular’s focus on simplicity has some serious consequences. There
are workarounds for some of these issues that you can implement
yourself in your project with great discipline, but ask yourself this:
are all developers on your team going to follow the same conventions?
Additionally, if you add all sorts of extra constructs to AngularJS to
make it work like Ember, why not just use Ember in the first place?"
Also take a look at: http://ryantablada.com/post/why-i-chose-ember-js
It depends on your preference, familiarity with the framework and most importantly project requirements.
I started using Angular but ended up with Backbone.
IMHO Angular is ok, but the learning curve is very steep, sometimes very difficult to get the desired behavior, where as Backbone, I was able to come up with a TODO in 2 days and took more than 5 days to design a todo in Angular.
The only problem with Angular is it tries to introduce it's own constructs, where as Backbone is like plain javascript gives one all the flexibility. I haven't tried Ember but might surely work upon in near future.

Getting Started with Durandal

I'm interested in building a SPA application. From what I can tell, Durandal provides the majority of what I'm looking for. Except, I'm looking for the most basic possible example that uses durandal. The sample app that's included uses bootstrap and sammy.
Is Bootstrap and Sammy required? If not, is there a sample I can see somewhere that doesn't have the code? I just want a basic app with two screens to use as an example. Yet, I can't seem to find the bare minimum example anywhere.
Thank you,
Version 1.20 of Durandal uses Sammy.js for routing if you include the optional router plugin. It is not necessary, but a pretty good idea to use it to simplify learning Durandal without having to learn how to route.
Durandal 2.0 is scheduled for release this month that gets rid of Sammy.js's dependency and has it's own router.
To find an example or sample app using Durandal that doesn't rely on either Sammy.js or Bootstrap will be difficult because they are easy to include, everyone understands them, and it's hard to go wrong when using these to simplify a sample app.
If you are looking for a very simple sample you can look up John Papa's CodeCamper JumpStart, but it includes a lot of other dependencies. The Durandal Starter Kit however is available on nuget and from durandaljs.com and has a single view and is an excellent way to start learning Durandal.js.

Categories

Resources