Tagged Questions
1
vote
0answers
21 views
Is this approach correct when testing an Angular controller?
I'd like someone to review these tests to make sure I'm along the right lines in Angular testing.
Note - They do all pass (great) but I feel like I'm struggling to understand the finer points of ...
3
votes
1answer
44 views
Angular directive for unique username
I looked at a bunch of AngularJS directives checking for uniqueness of a username and decided to try for the simplest implementation. It does what I want but may not really be 'idiomatic' Angular.
...
9
votes
1answer
117 views
Simple AngularJS controller for REST API
We record software builds from our build machine into a database and for practice purposes I'm building a little web dashboard for it.
The API is REST (WebApi) and provides access to query for ...
10
votes
1answer
74 views
A directive allowing to make a whole DOM subtree readonly
What do you think about this directive? For each input, it traverses the DOM towards the root and if it finds an element with the class ...
0
votes
1answer
40 views
Show <div> on <li> click
Simple task, I am just trying to have the data that correlates to a menu item hidden until it is clicked. However, I feel like this can be optimized. There are 2 ...
2
votes
1answer
45 views
Simple text toggling
I made a simple AngularJS text function. The purpose is to provide an array of content to display. A 'slider' will be made with next and previous buttons that hide on the last and first slide, ...
2
votes
0answers
28 views
Angular ui.route
I'm new to ui.router in Angular and have to build an app, which contains a header, sidebar (off-canvas), feedback area (save successful and warnings area) and a content area.
I thought it would be ...
5
votes
1answer
84 views
Basic and simple view, add, edit and delete functionality
I want to know what needs to improve with my application. Maybe there is a better way instead of what I am using currently.
index.html:
...
1
vote
0answers
76 views
A notification / interception implementation for AngularJS
I was in need of a thing that is able to inform my users about recent activities as well as intercept any action with a modal (e.g for undo purposes)
I decided that I will go for an independent ...
1
vote
0answers
60 views
Creating a new marker on a map
Is this code good practice? What kind of design pattern should I use for this specific situation?
The following function creates a new marker on a map. It sets a new image for it, except when the ...
1
vote
0answers
52 views
Angular.js directive for a vehicle model selector
I'm looking to take my JS skills to the next level - please be harsh...
...
5
votes
1answer
130 views
AngularJS Todo List - too much controller logic?
I am starting an angular app and I was wondering if I am on the right track with this. I worked on my last angular app when I was just a youngun who didn't understand the important of designing the ...
2
votes
0answers
53 views
Am I using Angular directives correctly?
I'm coming from Backbone and trying to wrap my head around Angular for a new project and would like to get some feedback on whether I'm using it correctly or not.
Plunker: ...
2
votes
2answers
78 views
Adding to an array, adding to an existing index if it exists
So I have this rather large function, which adds to an array. What it also does is searches the array to see if the item already exists and adds to the quantity if it does. If ...
6
votes
1answer
177 views
Angular dropdown
I have created this little dropdown directive in Angular. The idea is that you create a nav element with a ul inside. The directive prepends a chevron and toggles ...
2
votes
0answers
234 views
AngularJS with global data and “service” / using $watch on $rootScope
I am currently learning angular.js.
The following is an example I came up with. The goal:
An editor for a dict, the dict format is: {key: [type, data]}
A view of the same data
The "type" should be ...
1
vote
0answers
70 views
AngularJS constants depending on other constants - any established patterns?
I'd like to be able to define Angular constants in terms of other constants.
It's not possible to inject dependencies into Angular constant services. When I want ...
2
votes
1answer
60 views
Filling two angular $scope variables with data
I'm unsure about how to simplify this method properly. The method is basically responsible to allocate data.
The response object is a collection of objects. Each object contains an attribute called ...
1
vote
0answers
36 views
Factories and constructors in Angular?
I've got some constructors and a factory class that I would like to use in an Angular project. I would like to know how I can convert these to usable Angular services for my project.
Process ...
3
votes
1answer
59 views
Controller structure for a browser game module with filters and pagination
To get an idea of what the controller code reflects, here is a screenshot:
Basically, the idea is that you print out a list of football players which you can then filter by their name, price, field ...
3
votes
1answer
808 views
AngularJS Tab Control
I'm experimenting with angular directives, and as a proof of concept I wanted to create a basic tab control. I'd like to know if anything can be changed to be more fluid, or if I'm doing things ...
5
votes
1answer
71 views
AngularFire Tic Tac Toe Game
I am building a Tic Tac Toe game with AngularJS and making it online playable with AngularFire. The Tic Tac Toe logic is all there so this question concerns Angularfire a little bit more. I want to ...
1
vote
0answers
90 views
Angular directive with use of scope.$parent and $timeout
For the over eager people: check out this plunker
I create a directive which has to add buttons on top of input fields, to select the language you want to input.
This is used on forms, such as a ...
4
votes
1answer
135 views
Angular promise in service
I'm new with Angular promise and I would like to know how to improve my code.
I have a service which preload media or data by calling an API.
The media API return an array of urls to preload.
...
2
votes
0answers
89 views
Building a set of AngularJS directives to provide the user information about their input
I am trying to create an AngularJS directive that will give information to the user about the text they are inputting such as the number of characters they must or may enter and so on and so forth.
...
3
votes
1answer
324 views
Bootstrap/bind click event over ngClick
I am working on angularjs, and I have created some directives with bunch of HTML elements within its templates. I have assigned a controller for those directives. Below is my code snippet:
...
4
votes
1answer
45 views
Segment builder
I'm writing a pretty complicated piece of UI with angularjs. I've been using angular for about 2 weeks. I'm going to post the controllers I feel are the most confusing to read, and am wondering the ...
6
votes
1answer
240 views
Improvements to an Angular ScrollSpy module
Things that I'm not sure about:
Whether this works in all use cases - alongside routing and within templates etc
Am I polluting the scope with all these variables? This seems to be the easiest way ...
3
votes
1answer
2k views
Dynamic routing with lazy load controllers
While trying to create an "admin" backend (to allow for CMS like functionality) to a site using AngularJS on the frontend, I came across an issue with routes.
In order to allow the admin to create ...
4
votes
2answers
798 views
Simplifying an AngularJs directive that counts the number of characters entered in a textarea
I am trying to implement an AngularJs directive that would count the number of characters entered into a textarea and display it to the user.
Note: it will actually become much more complex later on ...
0
votes
1answer
147 views
Angular version of FitText
This project has evolved a lot since I started learning Angular. I'm pretty happy with it now, and I'm wondering if there's anything I can improve upon, or have forgotten at this point...
HTML
...
4
votes
1answer
65 views
Angular Modular File Structure
My intention is to separate components on a file basis. For example, I want a specific controller to have it's own file (Same goes with services, filters and directives). Of course, files will be ...
6
votes
1answer
1k views
Angular JS Switcharoo multiple select module
I have created a script for going a multiple select option in Angular without using a select box that you have to hold control in order to select multiple items.
...
2
votes
1answer
255 views
Angularjs Module Registration Structure
I'm using meteor and angular. Since I can't add modules after the angular bootstrap, I made a workaround and somewhat not satisfied with the way it was coded.
How can I improve this?:
...
3
votes
1answer
1k views
Sign-up wizard structure seems too repetitive
I think my current structure is way too repetitive. I feel like I must be missing something that would easily make this sign up wizard work far better.
...
4
votes
1answer
586 views
Angularjs extends service
As usual I'm wondering if there is a better way to do:
(The code extends a angular service)
...
6
votes
1answer
204 views
AngularJs and Google Bot experiment
I have learned the question of solving Angular app optimization for search engines, and was frustrated that the most recommended option is prerendering HTML.
After some time spent, I suggested to ...
3
votes
1answer
79 views
Structuring a reusable angular component with multiple communicating directives
I have a nested JSON of multiple levels. The last level has the "series data" that is to be added to the highcharts options to render the chart data of interest.
I am sniffing the JSON and populating ...
2
votes
0answers
2k views
Dynamically generating a HTML option list using Angular.js
I used step 4 from the Angular tutorial to do some tinkering of my own. In that particular step of the tutorial, a option list is created that determines how a list ...
1
vote
1answer
2k views
Directive to create a Google map
I have a considerably large directive which is doing many things: First it renders a Google Map, then it adds a listener to check when the bounds of the map change, then it renders points on the map ...
6
votes
1answer
296 views
Open source angularjs pouchdb model persistence layer - release ready?
I'm considering releasing a library as a bower module. Are there issues with code quality, missing test cases, that need to be addressed first? Perhaps it's not a good candidate for public release. ...
1
vote
1answer
229 views
1
vote
1answer
146 views
How could i improve my sisyphus-like service for AngularJS?
I have created a module/factory/directive for AngularJS which allows to save user input to localStorage and restore it if needed.
Although it works quite good, I am sure that I could improve its code ...
3
votes
1answer
106 views
AngularJS Improvement - Am I Starting Out Right?
I've recently just started with AngularJS and the best way for me to learn is to get some criticism to find out how I can do things better. I did a small project that calls a third party API and shows ...
2
votes
0answers
3k views
Bootstrap input validation error class [closed]
I'm trying to make example from this article using angular+bootstrap. I have this working code:
...
0
votes
1answer
958 views
Creating dialogs and modals with AngularJS
I wonder whether or not I should improve my current practice on creating/calling dialogs with AngularJS.
Think of a simple information, displayed on demand as a modal window. To create such a thing, ...
4
votes
1answer
47 views
“Stack exchange page visits” alike implementation
StackExchange page views works like this: Link
The objective is to increment the page visits by one. User should not be able to do this by refreshing. Number of visits can be incremented only if ...
3
votes
2answers
379 views
First angularjs directive
I've just written my first angularjs directive, and I was hoping to get some feedback. I already have two doubts myself.
Why is it that I must use ...
3
votes
1answer
2k views
In AngularJS, create lots of directives or use ng-controller?
This is a question about whether my coding style follows AngularJS best practices.
One of the selling points to Angular is directives. Directives allow you to create custom DOM with elements or ...
1
vote
1answer
141 views
Is it reasonable to expect this AngularJS function to perform well?
I have this function which is associated with a timer that I'm creating in AngualarJS. Should I be concerned about the function being able to execute quickly enough for the timer to be accurate.
...