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

Latest Stable Version:

Version Code Name Release Date
AngularJS 1.7.4 interstellar-exploration September 07, 2018

Actively developed Version:

AngularJS v1.7.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

262180 questions
4511
votes
15 answers

"Thinking in AngularJS" if I have a jQuery background?

Suppose I'm familiar with developing client-side applications in jQuery, but now I'd like to start using AngularJS. Can you describe the paradigm shift that is necessary? Here are a few questions that might help you frame an answer: How do I…
Mark Rajcok
  • 348,511
  • 112
  • 482
  • 482
3350
votes
30 answers

AngularJS: Service vs provider vs factory

What are the differences between a Service, Provider and Factory in AngularJS?
1993
votes
14 answers

How does data binding work in AngularJS?

How does data binding work in the AngularJS framework? I haven't found technical details on their site. It's more or less clear how it works when data is propagated from view to model. But how does AngularJS track changes of model properties without…
Pashec
  • 22,491
  • 3
  • 23
  • 26
1273
votes
19 answers

How do I access the $scope variable in browser's console using AngularJS?

I would like to access my $scope variable in Chrome's JavaScript console. How do I do that? I can neither see $scope nor the name of my module myapp in the console as variables.
murtaza52
  • 45,047
  • 27
  • 78
  • 118
1195
votes
22 answers

What is the best way to conditionally apply a class?

Lets say you have an array that is rendered in a ul with an li for each element and a property on the controller called selectedIndex. What would be the best way to add a class to the li with the index selectedIndex in AngularJS? I am currently…
respectTheCode
  • 40,233
  • 16
  • 70
  • 84
1105
votes
6 answers

How do I use $scope.$watch and $scope.$apply in AngularJS?

I don't understand how to use $scope.$watch and $scope.$apply. The official documentation isn't helpful. What I don't understand specifically: Are they connected to the DOM? How can I update DOM changes to the model? What is the connection point…
ilyo
  • 33,469
  • 40
  • 99
  • 145
1100
votes
15 answers

What is the difference between angular-route and angular-ui-router?

I'm planning to use AngularJS in my big applications. So I'm in the process to find out the right modules to use. What is the difference between ngRoute (angular-route.js) and ui-router (angular-ui-router.js) modules? In many articles when ngRoute…
1090
votes
18 answers

What is the difference between '@' and '=' in directive scope in AngularJS?

I've read the AngularJS documentation on the topic carefully, and then fiddled around with a directive. Here's the fiddle. And here are some relevant snippets: From the HTML: {{text}} From the pane…
iwein
  • 24,288
  • 9
  • 67
  • 108
1075
votes
9 answers

angular.service vs angular.factory

I have seen both angular.factory() and angular.service() used to declare services; however, I cannot find angular.service anywhere in official documentation. What is the difference between the two methods? Which should be used for what (assuming…
Jakob Jingleheimer
  • 29,050
  • 22
  • 73
  • 121
1044
votes
7 answers

'this' vs $scope in AngularJS controllers

In the "Create Components" section of AngularJS's homepage, there is this example: controller: function($scope, $element) { var panes = $scope.panes = []; $scope.select = function(pane) { angular.forEach(panes, function(pane) { …
Alexei Boronine
  • 10,901
  • 4
  • 17
  • 14
1041
votes
3 answers

What are the nuances of scope prototypal / prototypical inheritance in AngularJS?

The API Reference Scope page says: A scope can inherit from a parent scope. The Developer Guide Scope page says: A scope (prototypically) inherits properties from its parent scope. So, does a child scope always prototypically inherit from its…
Mark Rajcok
  • 348,511
  • 112
  • 482
  • 482
895
votes
12 answers

Working with $scope.$emit and $scope.$on

How can I send my $scope object from one controller to another using .$emit and .$on methods? function firstCtrl($scope) { $scope.$emit('someEvent', [1,2,3]); } function secondCtrl($scope) { $scope.$on('someEvent', function(mass) {…
Paul Kononenko
  • 9,297
  • 4
  • 16
  • 13
854
votes
28 answers

AngularJS : Prevent error $digest already in progress when calling $scope.$apply()

I'm finding that I need to update my page to my scope manually more and more since building an application in angular. The only way I know of to do this is to call $apply() from the scope of my controllers and directives. The problem with this is…
Lightbulb1
  • 12,674
  • 6
  • 19
  • 23
811
votes
17 answers

Insert HTML into view from AngularJS controller

Is it possible to create an HTML fragment in an AngularJS controller and have this HTML shown in the view? This comes from a requirement to turn an inconsistent JSON blob into a nested list of id: value pairs. Therefore the HTML is created in the…
Swaff
  • 13,038
  • 4
  • 22
  • 26
766
votes
33 answers

How to set focus on input field?

What is the 'Angular way' to set focus on input field in AngularJS? More specific requirements: When a Modal is opened, set focus on a predefined inside this Modal. Everytime becomes visible (e.g. by clicking some button), set focus…
Misha Moroshko
  • 148,413
  • 200
  • 467
  • 700
1
2 3
99 100