Questions tagged [angularjs]

Use for questions about AngularJS (1.x), the open-source JavaScript framework. Do NOT use this tag for Angular 2 or later versions; instead, use the [angular] tag.

AngularJS is an open-source JavaScript framework for building CRUD-centric Ajax-style web applications. Its goal is to shim the browser to augment the HTML vocabulary with directives useful for building dynamic web applications.

AngularJS ships with directives which add two-way data binding, DOM control and unrolling, code-behind DOM, form validation, and deep linking.

Initially released in 2009, AngularJS was developed and maintained by Google, and is used internally by Google in 1600+ applications.

Note: AngularJS refers to all 1.x versions of the framework, while Version 2 and higher are referred to now as "Angular" (see It's just Angular). The [tag: angular] tag should only be used for questions pertaining to versions 2 and higher.

AngularJS's Philosophy

  • Encourages developers to create their own directives, turning the HTML into a DSL suited to building their kind of application. The result significantly reduces the amount and complexity of JavaScript needed to build web applications.
  • UI is best described in the declarative form (HTML), and that behavior is best described in an imperative form (JavaScript) and that the two should never meet.
  • Encourages developers to design their client architecture using advanced software principles like dependency injection (DI), separation of concerns (SoC), testability, and a file structure.

Notable features

  • Teach your browser new tricks by adding behavior to HTML tags/attributes
  • Controllers provide code-behind DOM with clear separation from the view
  • Two-way data binding without the need to extend or wrap the model objects
  • Dependency injection assembles the application without 'main' method
  • Promises/futures remove many callbacks from code when communicating with the server
  • Directives
  • Views and routes
  • Filters
  • Form validation
  • Strong focus on testability
  • Extend HTML with your own behavior
  • Angular uses spinal-case for its custom attributes and camelCase for the corresponding directives which implement them

Versions

Notable AngularJS versions, code names, and release dates include:

Version Code Name Release Date
AngularJS 1.0.0 temporal-domination June 6, 2012
AngularJS 1.1.0 increase-gravatas August 31, 2012
AngularJS 1.2.0 timely-delivery November 8, 2013
AngularJS 1.3.0 superluminal-nudge October 13, 2014
AngularJS 1.4.0 jaracimrman-existence May 26, 2015
AngularJS 1.5.0 ennoblement-facilitation February 5, 2016
AngularJS 1.6.0 rainbow-tsunami December 8, 2016
AngularJS 1.7.0 nonexistent-physiology May 11, 2018
AngularJS 1.8.0 nested-vaccination June 01, 2020

Latest Stable Version:

Version Code Name Release Date
AngularJS 1.8.2 meteoric-mining October 21, 2020

Actively developed Version:

AngularJS v1.8.x  

For code names, release dates and notes visit the GitHub changelog. To see the latest announcements and AngularJS discussions, visit the official Angular Blog or AngularJS on Gitter

Bits

Community

Asking a question

  • Mention which version of AngularJS you're using
  • Reduce your issue to a small example
  • Explain the behavior you experienced and its difference from your expectations
  • Post a reduced working code on plnkr.co or jsfiddle.net
  • Don't know how? Clone one of these existing jsFiddles

Getting Started

Style Guides

AngularJS UI Libraries

Debugging

Testing

Recent

2014

2013

2012

2011

2010

Video Tutorials

Who is using

Developed by Google

262787 questions
42
votes
8 answers

$http Auth Headers in AngularJS

I have an angular application that is hitting a node API. Our backend developer has implemented basic auth on the API, and I need to send an auth header in my request. I've tracked down: $http.defaults.headers.common['Authorization'] = 'Basic ' +…
mwatkajtys
  • 421
  • 1
  • 4
  • 3
42
votes
4 answers

Why would one want to use Express instead of AngularJS?

I understand that Express resides on the server and Angular resides on the client but, as far as I know, Angular can do everything that Express can do which is routing interacting with the database It kind of seems like maybe Express is needed in…
user883807
42
votes
13 answers

Preventing / dealing with double button clicks in angular

In angular we can set up a button to send ajax requests like this in view: ... ng-click="button-click" and in controller: ... $scope.buttonClicked = function() { ... ... // make ajax request ... ... } So to prevent a double submit…
Breako Breako
  • 6,353
  • 14
  • 40
  • 59
42
votes
9 answers

AngularJS: textarea bind to JSON object shows "object-object"

I am fairly new to AngularJS. I am trying to bind an object to a textarea. HTML: Model: { "kind": "title", "label": "ADD_TITLE", "iconSrc": "textTitle.png", …
Guy
  • 12,488
  • 16
  • 79
  • 119
42
votes
4 answers

AngularJS CORS Issues

I have searched over 200 sites(maybe exaggerating, but not by much) on how to be able to handle cors with angularjs. We have a local machine running a web API server. We are developing a client that calls on the API for data. When running the…
Shane
  • 548
  • 1
  • 6
  • 17
42
votes
2 answers

AngularJS $http vs service vs ngResource

I would like to understand the advantages and disadvantages of using a simple $http request to a server and/or wrapping that request in a service versus using a ngResource object (other than the obvious regarding a RESTful resource). From my…
adamK
  • 3,849
  • 5
  • 37
  • 49
42
votes
9 answers

Angular JS Scaling & Performance

We are pounding our heads against performance issues with an Angular app we are building for a bank. Unfortunately, it is a breach of contract to show snippets of the code. Regardless, I can describe some of the main issues going on, and I am hoping…
42
votes
1 answer

Passing variable to Angular Directive

If I have a directive myDir and I call it within ng-repeat like so How can I access myindex? I get actual string {{$index}} when I use attrs.myindex within postLink function. When I inspect html, it actually…
Massive Boisson
  • 1,617
  • 7
  • 22
  • 28
42
votes
4 answers

Mock a service in order to test a controller

I have a ParseService, that I would like to mock in order test all the controllers that are using it, I have been reading about jasmine spies but it is still unclear for me. Could anybody give me an example of how to mock a custom service and use it…
Javier Hertfelder
  • 2,432
  • 4
  • 22
  • 36
42
votes
5 answers

Binding inputs to an array of primitives using ngRepeat => uneditable inputs

Here is a demo to my problem. $scope.myNumbers = [10, 20, 30];
       
current scope: {{num}}
Can anyone explain to me why are the inputs uneditable/readonly?…
tamakisquare
  • 16,659
  • 26
  • 88
  • 129
42
votes
5 answers

how to pass "question mark" in url javascript

In Angularjs app, i have a url like http://url.com/my_app/#/store/items. Now i want to append query string for example, http://url.com/my_app/#/store/items?page=2. but in url, javascript encodes the "?" to "%3F" which i don't want. It should remain…
Amb
  • 3,343
  • 7
  • 27
  • 34
42
votes
15 answers

Different ng-include's on the same page: how to send different variables to each?

I've got a page in my AngularJS app in which I would like to include the same html partial, but with different variables. If I do this in my main html:
Jasper Schulte
  • 7,181
  • 7
  • 23
  • 19
42
votes
8 answers

angularjs: how to add caching to resource object?

To add caching inside http is pretty straight forward. ( by passing cache=true ) http://docs.angularjs.org/api/ng.$http has Cache option. How do I add similar functionality in $resource in angularjs ?
iamgopal
  • 8,806
  • 6
  • 38
  • 52
42
votes
8 answers

AngularJS ng-options create range

I am trying to create a select element that has a list of numbers 1 to pages where pages is a variable that is the number of pages I have. What i don't know how to do is to structure the ng-options expression so that it will give me the numbers I…
d_boggus
  • 1,019
  • 2
  • 9
  • 21
42
votes
4 answers

D3 within an AngularJS app

I'm trying to create my first app with AngularJS. It looks neat, but there's a lot of abstraction, and I'm just curious if anyone has advice on the most idiomatic way to use the angular methodology to update visuals created with d3js. Thanks, bp
BHP
  • 985
  • 2
  • 14
  • 18
1 2 3
99
100