Questions tagged [angular.js]
Code written using version 1 of the AngularJS open-source JavaScript framework. Use 'angular-2+' for code using later versions.
354 questions
10
votes
2
answers
2k
views
Ionic REST + Authentication
I have an app that makes calls to the Podio API. The Podio Api uses OAuth2 protocol , after user's authenticate with their podio username and password an access and refresh token is provided for ...
5
votes
1
answer
129
views
Google oAuth Angular service
I wrote a module with 3 services that execute the oauth (and set the api key) for the google api and return the token object if the promise is positive.
Here is the whole working module:
...
1
vote
1
answer
934
views
Angular directive test
I'm learning how to write tests in Angular (these are my first tests in general). There are a lot of tutorials out there but each one of them has a different approach. I'm a bit confused if I'm doing ...
2
votes
1
answer
113
views
Ad filtering in Angular factory
I'm an 'old school' programmer (C, C++), and I have step-by-step, algorithmic thinking. I'm writing some code in Angular + Django and I know that this code is ugly but I don't have any idea how to ...
3
votes
0
answers
141
views
Angular OOP services and caching
I've created a caching service using OOP techniques combined with the revealing module pattern and the angular-cache library. New CacheDataClass objects are ...
2
votes
2
answers
117
views
Checking array for tags
I call a service which returns an array of tags. The array may be empty, and if so, it just saves the tag. Otherwise, it checks if the tag is in the array. If so, then the tag is removed, otherwise it'...
3
votes
1
answer
69
views
Controllers for interacting with a vacation service
I have a controller called VacationController; in this controller, I retrieve a list of vacations which will be displayed in a grid.
In the grid, I have the option to create a new vacation through a ...
2
votes
1
answer
171
views
Handling success and failure when retrieving product information
I've got an Angular controller where I have two functions that are repeated inside two functions:
...
1
vote
1
answer
254
views
Controller scope inside Directive with Angular
I decided to write a simple runnable example to try and express my concern:
index.html
...
2
votes
0
answers
92
views
Trade off in database efficiency versus a nested for loop on client
I built an app where a user has a recipe box with recipes in it - for the db, there is a user and recipe model, user has "recipeBox" property. The recipebox is an array of objects like so:
User ...
2
votes
1
answer
2k
views
AngularJS code to query DB and update $scope
I have an AngularJS function that is used to determine which $scope associative array variable is to have data pushed into it. I would love to be able to remove the ...
7
votes
3
answers
196
views
Exposing a directive's computed variable
I have a directive called meetingList with its own isolated scope that receives a list of meetings and displays the filtered items based on some criteria. The ...
2
votes
2
answers
310
views
Handling rejected HTTP responses with status 401
I'm kinda new to javascript and have question about it. Now my practical project is growing a bit bigger. I got the following if else statement. Is it possible to refactor this ? Should i use an use ...
2
votes
1
answer
1k
views
A dirty port of a Google Image Search layout clone jQuery plugin to Angular JS
I took the basic layout manipulation from a jQuery plugin called flexImages. The idea is to use the directive tag and encapsulate a piece of code that will be transcluded to make up the container ...
4
votes
1
answer
374
views
Angular wrapper for SignalR event aggregator
I created a little wrapper for one of my JavaScript libraries to enable Angular functionality. Are there any pitfalls I should be wary of with my code?
...
3
votes
1
answer
811
views
Countdown directive built using Angular
I've built a countdown directive for a website I'm working on, and it actually functions just fine. It simply parses a given date, splits the total time remaining until that date up into Day, Hour, ...
1
vote
1
answer
13k
views
Fetching of JSON data through an API with AngularJS
I have been trying out AngularJS and developing a mobile application to test out its features and I wanted to see if I could somehow refactor to make my JSON response hopefully quicker in fetching the ...
1
vote
1
answer
203
views
Resumé builder app
Wrote this an hour or so after learning some basics.
Took me a while because I had to write it in a way to fit the previous structure of my page. Basically, there are three rows of data. There has to ...
3
votes
0
answers
61
views
Using Angular directives for connect HTML clicks in buttons and controller actions
I'm trying to improve my Angular directive. I'm pretty new to CoffeeScript, so I think there may be inconsistent code.
...
1
vote
1
answer
172
views
Retrieving objects from JSON URLs
This is an accounting program (and my first attempt at a web app of any kind) where users need to get and retrieve objects from different JSON URLs and at different levels. Rails is used for the back.
...
7
votes
1
answer
47k
views
Merging two arrays of objects with different keys/properties [closed]
I have two different arrays:
...
2
votes
3
answers
224
views
Save handler without a nested "deferred antipattern"
I have an application in which a user makes a change, and when they click Save they will be prompted to confirm, and the appropriate REST call will be made if they agree. The intial call to ...
0
votes
1
answer
1k
views
AngularJS directive for common form fields
I have created a directive for common form fields shared across all the forms in a large AngularJS app I am re-factoring.
The app has lots of forms for various data models (user, owners, victims, ...
3
votes
1
answer
361
views
Angular todo list
I'm not sure whether my code looks good or not:
...
15
votes
2
answers
14k
views
AngularJS - REST + Authentication service
I have a REST web service that uses OAuth 2 for authenticating and authorizing requests.
I have an endpoint, that when receiving the correct credentials, responds with an access token that will be ...
7
votes
1
answer
666
views
UI selector directives for an AngularJS invoicing module
I'm wrapping ui-select in my own directives to pre-configure and style it, as I need it for my app in different select widgets. They appear on many pages, for example ...
4
votes
1
answer
6k
views
MVC partial views and AngularJS modules
I am using MVC+Angular. In MVC, I created partial views for search, listing, etc. I show them using:
...
3
votes
2
answers
122
views
MVC and Services
I'm writing and app in AngularJS and am learning about writing RESTful services. I also want to make sure that I'm understanding the MVC pattern correctly. In my code, this is my take on how I'm ...
2
votes
1
answer
589
views
AngularJS to-do list controller
I am new to Angular. Am I following best practices here? I understand controllers should not do too much. My controller seems to have a lot of logic here. Can I do anything to improve it? It is just a ...
1
vote
1
answer
49
views
Shuffling and hiding views specified by parameters
In my Angular app, users click on different icons. When a user clicks on respective icon, I can show the icons gallery, as well shuffle the view.
Apart from this ...
2
votes
1
answer
2k
views
Navigational bar content built depending on login state
I created a login service which holds a boolean based on if a user is logged in or not.
...
4
votes
1
answer
6k
views
Angular directive to toggle sidebar visibility based on window width
I changed the normal way of using Angular. I'm using my controllers just to talk to my API routes and am using directives to manipulate the data and DOM as well.
I am using the object literal pattern ...
3
votes
1
answer
76
views
Checking tag colors
I have an array vs.tags which may contain hundreds of objects, and a smaller array coloredTags which only contains up to 3 ...
3
votes
1
answer
409
views
Creating a symbol toolbar with Angular
I have been given a requirement to create a symbol toolbar, a toolbar where each button represents a unique symbol.
This is how the toolbar would work:
A user clicks inside a text field and enters ...
2
votes
1
answer
64
views
Showing popup according to the header nav link
I am showing templates in popups according to the user navigation links. It works for me, but, is this the correct way to do it?
...
6
votes
2
answers
251
views
Profiles with profiling checkboxes
I have this HTML down below that creates a list with two columns, the left one containing profile information, and the right one containing checkboxes of the user feedback in a horizontal list.
The ...
1
vote
1
answer
230
views
Angular ng-show
Is there any easier/shorter/better way to do the marked part?
plnkr
...
26
votes
5
answers
2k
views
Cardshifter game lobby
We've been hard at work creating a browser-based GUI/Client for playing the Cardshifter TCG for the past week or so. Today, I just finished doing a pretty complicated layout for the chat lobby, along ...
7
votes
1
answer
986
views
Datepickers for departure and return dates
I have to two datepickers. I want achieve the following functionality: the return date cannot be selected before the selected departure date and the departure date cannot be after the selected return ...
3
votes
1
answer
76
views
Width-based panel collapsion
This code adds the toggle functionality for mobile devices. So, for width lower than 990px, the panel collapses, and the user can toggle to open / close it.
...
1
vote
1
answer
95
views
Formatting data for use in a controller
I am using the function inputSetup to prepare an array for a multi-select directive. I am passing in an array with the existing selections (...
6
votes
1
answer
1k
views
Mocking dependencies when unit testing AngularJS services with QUnit
I'm trying to unit test an AngularJS service that is dependent on another service, using QUnit as my testing framework. The first test I'm writing is one to verify that my service calls another ...
3
votes
1
answer
70
views
Adjusting Angular.js model based on browser width
I have an Array of 5 objects, some key values need to be changed based on the browser width. ie: 5 cols, 4 cols, 3 cols or 2.
vs.streams is an Array which is tied to a AngularJS model. When the ...
0
votes
2
answers
6k
views
Program that filters JSON data based on user selection
I have made a basic program using AngularJS that displays data from a JSON file, and filters it according to the user's selection (specifically FIFA 15 chemistry cards).
I did plenty of CSS work to ...
2
votes
1
answer
361
views
Bootstrap Modals
I am learning how to implement Bootstrap modals in AngularJS. I can do it when the modal code (the actual popup window code) is on the main page, but I want to be able to display external files so ...
2
votes
4
answers
25k
views
Function to split full name into first & last
In angular, I have an input field for a user's full name. And a function called splitName which extracts the first / last name from the field. Is there a way to ...
3
votes
1
answer
558
views
Iterating through a range using lodash/AngularJS and saving data
The code below doesn't seem right to me. The scenario is:
User enters in a "quantity" into a form field.
If the user enters in 5, the loop below should iterate 5 times.
There should now be 5 new ...
2
votes
1
answer
146
views
Controller.js of CRUD vehicles
I never took an application in a Model-View-Controller architecture and have some difficulties in front-end. The following code works fine, but what can I do to make "layers" of better code and even ...
1
vote
1
answer
78
views
Scroll related inline image resizing
I have been working the some project and I'm struggling to find the answer. Right now I'm coding with Angular and there some code that makes me write twice. There only two arrays now but if I have ...
2
votes
0
answers
264
views
AngularJS Cookie Manager
Just looking for an initial steer on my AngularJS implementation.
Background
Started work on a clients new site which uses a popular CMS as the backend and AngularJS has been chosen as the client ...