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
0
votes
1
answer
331
views
AngularJS calendar directive
Is adding CSS to template via <style> the right approach?
How should I structure the application?
Plunker link to the code
...
3
votes
1
answer
158
views
Struggling to unit test Angular, was this module the best approach?
As a development team we've recently started to transition from MVC to Angular. None of us have had prior experience with it so a lot of creating the new client was very much trial and error. I've ...
0
votes
1
answer
4k
views
Dynamically set angular directive template
I have recently upgraded to AngularJS 1.5 and as the title says, I want to use different templates depending on a value in the ...
0
votes
1
answer
58
views
Abstracting out two lines of code in Coffeescript
I am currently working on refactoring two methods that exist in directives into a service.
This is method one:
...
1
vote
1
answer
4k
views
Call multiple services from angular2 component
This is my first Angular2 component, which makes two api calls: the first call provide the input for the the second one.
The following is my attempt at this code.
...
1
vote
1
answer
355
views
Angular UI-Router Repetitive templateProvider Using $rootScope
I am developing an application that has different configurable versions - "a1" and "a2". The version name is initially being set from the database as "a1" in the $rootScope.
I reference the version ...
3
votes
2
answers
3k
views
SQL LIKE search in Angular filter objects
I made this AngularJS 1.x filter, to search using a the same SQL LIKE syntax. Right now only the percentage symbol (%) is ...
2
votes
2
answers
154
views
Angular filter based on properties
I wrote a Angular filter to use filters based on properties that handles some specific properties differently.
Is there a way to improve or use some built-in Angular filter to avoid extra code?
...
5
votes
1
answer
117
views
Angular directive to fetch resources to fill a table
I created a directive that solves my immediate problem, but I'm trying to find ways to make it more reusable.
My immediate problem was, I have a table and needed to fill in one of the columns with ...
4
votes
1
answer
3k
views
AngularJS recursive function call with $timeout
I have created a recursive function call in AngularJS and just wonder if is there a better way to solve this problem? The code works perfectly.
My code is the following:
...
2
votes
0
answers
845
views
Flattening nested Observables in Angular 2
I'm new to Observables. I'm using them to check if the user is logged in or not in the constructor of my root page.
I have nested many Observables in order to do this, and they are working fine, but ...
2
votes
0
answers
2k
views
Django REST custom methods for generic views
I'm intern and work on a project where I develop DRF API that need to interact with mobile app written by my colleague with Ionic framework.
We are creating new user. My view method is following:
<...
2
votes
1
answer
91
views
AngularJS apply filters on data previously filtered
I have a $scope.users that I use to show a table and I need to apply a filter with multiple options,
Here is the $scope.users ...
2
votes
1
answer
2k
views
Progress bar/loader with AngularJS
Here is my code to add a progress bar on every HTTP request. Can someone please point out to me whether I am doing it right or not?
Template for loader:
...
3
votes
1
answer
12k
views
Convert all dates in an array to date format
I'm returning an array containing dates (and other things) from an API, then looping through the array on the front end to convert them into dates
The backend uses Node.Js and queries a mySql ...
3
votes
0
answers
96
views
Prevent search changes from spamming history
This is my solution to my SO question. My requirements are:
use links inside of the angular app
when following a link with the same path (i.e., differing in the <...
0
votes
1
answer
94
views
Validating search parameters in an Angular $scope
I am using the following function to make a specific filter passing the $scope.searchParams in this way:
...
2
votes
0
answers
85
views
Microsoft Office 365 Addin Angular Form
This is my first time making an Office 365 Addin and wanted advice on my current form structure.
I'm particularly looking for advice on best partices for constructing directives and how to properly ...
3
votes
1
answer
3k
views
Angular directive link vs controller?
I have a very simple directive <my-card> that lists out some data.
Example Usage
...
3
votes
1
answer
133
views
Display captions based on video time
I need to display a "caption" from a video but I cannot use built in captions provided by a vtt file for my situation. I created an array that stores the key,value pair (time, caption). I traverse ...
3
votes
0
answers
65
views
Dynamically displaying different controllers
I have here a simple webapp for displaying different D3 demonstrations:
The idea is - the user can select one of many modules in the control bar at the top, and the corresponding controls for that ...
5
votes
1
answer
3k
views
Currency converter built with AngularJS
I am fairly new to AngularJS and I am trying to improve my knowledge of this JavaScript Framework by building small real-world web-apps.
In this case, I have built a currency converter app with ...
3
votes
1
answer
1k
views
AngularJS application to display 10 search results at a time
I am working on an angular application. I have written a controller for a page which gets 10 objects from an api. On clicking the next button, it gets the next 10 objects and so on. I have also added ...
1
vote
1
answer
192
views
Simple Todo app
I'm writing a todo app as a test. Having never done Ionic nor Angular apps before, I am not sure if I am following best practices here.
What I have done is try to keep my controllers thin by placing ...
4
votes
1
answer
123
views
javascript - create an object containing objects based on JSON data
Based on JSON data I receive, I am trying to track a team's home and away games. The JSON data is stored in $scope.gameSchedules and has "team1" for home games and "...
1
vote
1
answer
292
views
Angular template for a dropdown menu
I'm ashamed to ask such an elementary question but I tried to DRY up this template a couple ways and couldn't come up with anything I was satisfied with. Can you help?
...
1
vote
1
answer
104
views
Angular Promise trying Wrapper
Sometimes I need to repeat an execution of rejected promises several times, for example, to fetch some data over internet.
There is a wrapper, which accepts Promise and tryCount:
...
2
votes
0
answers
159
views
Jasmine Unit tests for simple Angular backend interaction
I have a simple Angular application that lists some object requests from a backend, allows the users to click once to edit the item, and then click again to update the object in the backend.
Here's a ...
1
vote
3
answers
99
views
Deriving stars from a product score
This function derives a 'stars' rating from a product score that is retrieved from local storage. What would be the best way to refactor these else if statements?
...
2
votes
1
answer
106
views
ReactiveX observable that uses another observable
I am trying to write an Angular service that will wrap the regular Http service and automatically make authentication calls if Bearer token is not available or invalid.
Here's an illustration of a ...
0
votes
1
answer
80
views
Angular controller to handle showing or hiding multiple widgets
I have 7 variables controlling 7 widgets showing or hiding from the frontend. I want to put them together and control all of them using one function. Here is what I have. However, I feel like even ...
5
votes
1
answer
128
views
Summarize JS Array more efficiently
I am working on a project for Udacity, where I should use CSV files to display data on fake corporate dashboard. Structure of the data I am working on is like this:
I am using AngularJS for this ...
10
votes
1
answer
252
views
Baseball player statistics controller
I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that hoisted function declarations can lead to issues. If you have any pointers on how to structure my file, those would ...
9
votes
1
answer
659
views
Animate and play sounds in Simon Says 'the Angular way'
I am a newbie coder and I'm trying to learn good coding habits. I'm making a Simon Says game challenge from Free Code Camp in Angular JS.
Codepen
I have an array that keeps random integers between ...
0
votes
1
answer
79
views
Function to ensure that at least one choice is selected
First here is my settings object below. insight, spike and ...
2
votes
1
answer
84
views
Stranded messaging Angular web app - main template for all views to live within
I'm making an Angular web app to solve a pain with traditional messaging my friend and I had, of sending batches of messages (on multiple different topics) to each other every few hours and not having ...
3
votes
0
answers
66
views
A simple list of objects to display and edit with Angular
I want to create a simple CRUD app using angular on the frontend.
I'm not really happy with the logic here, it seems a bit convoluted for fairly simple functionality.
...
2
votes
2
answers
842
views
Flickr API with Angular
I have built the following application which searches Flickr API and returns photos. I am presenting the code:
index.html
...
1
vote
1
answer
116
views
Reservation booking code samples
I am putting together a couple code samples for prospective employers and would love some feedback. I am still pretty junior so I am not sure what constitutes a good code sample and the do's and dont'...
2
votes
3
answers
125
views
Validating five date fields in Angular.js
So I have following piece of code which basically validates five date fields in angular service.
But the catch is that there may be one to five field(s) visible on the screen based on some other ...
1
vote
2
answers
151
views
Grab photos from Flickr
I wrote the following code for a coding challenge I was given and it received the following criticism: it was quite a beginner attempt using Angular.
...
5
votes
1
answer
736
views
BlackJack in Angular
I wrote the following code in Angular as to accomplish a technical test for a UK job. My impression was that it is very neat and well object oriented. To my big surprise, they rejected it. Could ...
2
votes
1
answer
252
views
Add items to a list, or update the quantity if already in the list
I have several lists that contain Part objects with a partNumber and quantity. When the user ...
1
vote
1
answer
1k
views
Creating Menubar using Angularjs 1.5
I've a sample code to create a simple menubar here which works, but I'm not sure if that's the best way to code it. Can somebody please validate if there is a better way to do the same?
In short
I'...
2
votes
1
answer
127
views
AngularJS services for APIs in large applications
I've been reading about AngularJS services and factories, and how you should strive for a thin controller, but as the project I've been working on grows it seems more and more impractical with as ...
3
votes
0
answers
730
views
AngularJS client side logging in a MVC web application
Being a newbie into AngularJS, I have overlooked the importance of client side logging until some non-reproducible client-side errors occurred and I realized that they were not logged.
My web ...
4
votes
1
answer
157
views
Conditional async validation function
We have the following validation function:
...
4
votes
1
answer
358
views
Implementing tabs with panes
I am new to AngularJS. Here is my basic code for implementing Tabs with Pane. Eventually, each tab-pane will have a form and a ui-grid that will display data from the DB.
Can I use separate ...
2
votes
0
answers
206
views
Angular validation function for a user creation form
I have to make a user creation wizard, there are 3 steps to achieve the insertion of a new user, so every step I have have a validation function to enable the next step.
As a first step for the ...
4
votes
2
answers
2k
views
Angular notification (alert) factory or directive
I am new to AngularJS and I thought of trying something simple: a notification factory that is useful for displaying actions alert messages like "Save successfully!" or "Validation errors: ...".
The ...