Use angular in laravel views - angularjs

this is my firs question here but Ive been trying to find a solution these days. Im building a multi-page website and Id like to use angular for front-end. Ive seen most of the people have the issue of combining the angular syntax with laravels but Id really like to know if its possible to include angular into one of laravels views without having to re-route to an angular.html page from angular directory.
Basically I want to know if theres a way to use angular directly into "Route::get('test', 'Controller#getTest')"
The problem is that when I set the response on the controller page( return view('pages.test')->with(array('1' => $1, '2' => $2)); ) the angular scope method gets the data as a whole and its hard to target the array 1 for example to use it in my AngularController
Hope this makes sense.... THanks in advance!

Related

Dynamic url parameters and UI Router

I'm trying to figure out how I can get query parameters in the url using UI Router and AngularJS UI Bootstrap Typeahead fully working.
I have it working (well... kind of). What happens is that you have to search twice, once puts the query in the url and twice gives you results. Not ideal.
After doing some more searching and reading, I found this answer and it seems that using an $http service would be a good way to go. However, I'm only using ONE controller with 2 views. Will that still work?
UPDATE
The answer in the link provides an answer based on having 2 controllers, whereas I only have one controller.
So my question(s) is would using an $http service to store my query in enable me to put the query parameter in the url using UI Router and AngularJS UI Bootstrap Typeahead? Is this SOLEY a UI Router issue or is UI Bootstrap Typeahead play a role in this?
Code:
In my controller I initialize the relevant code like this:
$scope.searchTerms = $stateParams.searchTerms || '';
and use $state.go in my search function like this:
$state.go('search', {q: $scope.searchTerms});
It works like I said, but only after submitting the search query twice. Trying to figure how to get it working normally.

Magento with Angular Js

I want to build Magento store with Angular-Js for that I have read so many article on net and check stack overflow questions but I am not getting up to the mark answer so I decided to ask with my own problem.
For ex: I want to use Angular-Js in Magento for list page(category page) for that what I need to change and where?In which file I need to add angular controller , model , route and all stuff related angular? If any one is there who has used Angular with Magento before please help me to clear my problem.
I think we need to change core Magento controller files may be but not sure.
Thanks in advance.

angular js template with routing and translate refusing to work

I am new to angular and it seems very interesting
I am creating a template for a promotional page and struggling to understand what is causing an issue on it - half of the script stopped working...
My fiddle is in here see >
fiddle example
or Plunker
I have working example without route...
Can you advice me how to fix this issue please
First of all, i'd suggest you to separate your project to different files based on best practises
Secondly, 'config, controller, factory' etc are methods of angular.module object. So you need to retrieve it first like
angular.module('<moduleName>').config(...)
or use some variable.
http://plnkr.co/edit/CK5R2cS7Zd9T9Kun9Epc?p=preview

Angularjs: Multiple file-uploader in a single page

I am facing lot of problem in while using more than 1 file uploader in single page. There is any directive for this? because I didn't find it. By the way I am using Bruno Angularjs uploader Directive and tried to change multiple but getting problem while form submitting beacause all uploaders sharing same model so thats why I was not able to get all the values at a time only one can be access.
So if anyone have some solution or suggestion for this, please share with me.
There is a good jquery ajax uploader which is available in angualar js version also.
Please check here http://blueimp.github.io/jQuery-File-Upload/angularjs.html

AngularJS $route service undesirable hash issue

I'm working on a big project. This project already has complicated structure. Most pages are generated on server-side with Twig.
Now we move the project to AngularJS.
It is not possible to use angular-way routing on whole project just now. But somewhere, it is necessary.
And here comes our trouble.
If I add 'ng-app' in html tag, for example, on some pages angular add hash in url.
And what is strange for me, that it's not everywhere.
On start page (project/profile9868766), url is clear as it is. But on some other (project/community/list), angular does something like that: project/community/list/#list .
And it is extremely undesirable.
There are no any angular routes, configured in $route service yet.
Please, help me to find out what causes that behavior, and what should i do to make all the things to go right way.
I want to add ng-app in html tag and not get any troubles with existing code, that may use hashes. And I want to use angular directives, controllers and other stuff, including $location service to set and track hashes on some pages. And later move everything to Angular and only after that start using Angular routes.
Thanks!
PS: English is not my native language, sorry about some weird constructions and mistakes. ))
Make sure to turn on html5mode
http://docs.angularjs.org/guide/dev_guide.services.$location
But the hash is inevitable on non-html5 browser.
The latest version of angular (v1.0.7) seems to have fixed this issue.

Resources