Questions tagged [ng-controller]

The AngularJS ngController directive attaches a controller class to the view. This is a key aspect of how angular supports the principles behind the Model-View-Controller design pattern.

186 questions
1
vote
1 answer

Call multiple modules in a single page?

I created module1 and module2 in a single page. module1 is working fine, module2 is not working. Please suggest how to call module1 and module2 correctly in a single page.
Shakeer Hussain
  • 2,230
  • 7
  • 29
  • 52
1
vote
0 answers

How to make a GET Request in AngularJS to a RESTful Web API?

I'm making a simple CRUD application to CRUD products. A product has an ID, a Name and a Price. I have built an ASP.NET Web API to store these products and I was trying to call this API in an AngularJS SPA. I have built a module and corresponding…
João Paiva
  • 1,937
  • 3
  • 19
  • 41
1
vote
3 answers

How to use same ng-app for 2 different html page?

I have 2 html page and one app.js my search-movie.html code as the following : Search Movie
eagle
  • 451
  • 1
  • 7
  • 27
1
vote
2 answers

How to fix "Uncaught Error: [$injector:modulerr]" error?

I am trying with angularjs but I get this error : Uncaught Error: [$injector:modulerr] This is my html code : Search Movie
eagle
  • 451
  • 1
  • 7
  • 27
1
vote
2 answers

Get pristine value in Angular controller

I need to be able to see in the Angular controller if the datepicker is pristine or not. Tried all sorts of things including sending the pristine value in a method but cannot get this value. Below is the view code:
Afshin Ghazi
  • 2,784
  • 4
  • 23
  • 37
1
vote
2 answers

AngularJs - Using ng-controller with ng-include

This works:
However, this doesn't ({{test}} outputs nothing):
Shawn
  • 2,675
  • 3
  • 25
  • 48
1
vote
2 answers

ng-model is undefined from controller

fiddle Hi, Why the value from foo() function is undefined? I found that the problem is if the model name is only brandbut, it is not my problem. The name of my model is car.brand. So my question is - how to access model from ctrl? HTML:
user3700786
  • 149
  • 1
  • 13
1
vote
2 answers

Boostrap 3: Click over button doesn't work

I'm working on a web application which uses AngularJS and Twitter Bootstrap. My app works fine with Firefox, but with Chrome or Chromium (my operation system is Ubuntu) when I click button, this click is not detected correctly. The click is detected…
José Carlos
  • 2,850
  • 12
  • 59
  • 95
1
vote
2 answers

Dynamically set controller for view using ngRoute in AngularJS

I'm using params to dynamically route URLs to different HTML. Is there any way I can set different controllers for those views? Or I should separately route them and use controller and controllerAs to set controller? Since all of the templates are…
SmartFingers
  • 105
  • 1
  • 8
1
vote
1 answer

How to implement multiple ng controllers with http calls in AngularJS?

In an app / on a page I have several places, where data should be loaded asynchronously. E.g.: a DIV with images and another one with cateories (for the navi). I implement it like this: app.js (function() { var app = angular.module('portfolio',…
automatix
  • 14,018
  • 26
  • 105
  • 230
1
vote
1 answer

Ng-Show With Cookies

I am trying to set the ng-show variable isloggedout with the cookie Value, which is working (therefore the $scope.isloggedout is either true or false) which should trigger the ng-show or ng-hide which is clearly not working. My App…
Luke Cassar
  • 21
  • 1
  • 8
1
vote
1 answer

Angular module for handling request outcomes

I'm working on an Angular controller, where on load make multiple async requests. First request dataA and dataB. If the first request is successful, and dataA is found, and based on it's property I request dataC and dataD. For each request I need to…
fodma1
  • 3,485
  • 1
  • 29
  • 49
1
vote
0 answers

AngularJS ng-controller in html root element

I have an AngularJS document where I need to set fields in various parts of the document. This includes e.x. the tag. So my document Looks like the following: <html ng-app="test" ng-controller="TestCtrl"> <head> …</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/javascript" class="post-tag grid--cell" title="show questions tagged 'javascript'" rel="tag">javascript</a> <a href="../../questions/tagged/html" class="post-tag grid--cell" title="show questions tagged 'html'" rel="tag">html</a> <a href="../../questions/tagged/angularjs" class="post-tag grid--cell" title="show questions tagged 'angularjs'" rel="tag">angularjs</a> <a href="../../questions/tagged/ng-controller" class="post-tag grid--cell" title="show questions tagged 'ng-controller'" rel="tag">ng-controller</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 25 '15 at 10:07">asked Nov 25 '15 at 10:07</time> <a href="../../users/4952137/thomas-sparber" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/4952137.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Thomas Sparber" /> </a> <div class="s-user-card--info"> <a href="../../users/4952137/thomas-sparber" class="s-user-card--link">Thomas Sparber</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">2,827</li> <li class="s-award-bling s-award-bling__gold" title="2 gold badges">2</li> <li class="s-award-bling s-award-bling__silver" title="18 silver badges">18</li> <li class="s-award-bling s-award-bling__bronze" title="34 bronze badges">34</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-33615237"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status "> <strong>0</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/33615237/why-if-i-load-a-template-dynamically-in-chrome-element-scope-is-undefined-whil" class="question-hyperlink">Why if I load a template dynamically, in Chrome element.scope() is undefined while it's defined for FireFox?</a></h3> <div class="excerpt">I'm trying to register/load controller, after loading the mathching block/template dynamically by EJS(javascript): logMessage("Rendering " + section + "using the following: templates/blocks/" + pageRegister[pageIdentifier].blocks[section][block]…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/angularjs" class="post-tag grid--cell" title="show questions tagged 'angularjs'" rel="tag">angularjs</a> <a href="../../questions/tagged/ng-controller" class="post-tag grid--cell" title="show questions tagged 'ng-controller'" rel="tag">ng-controller</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 09 '15 at 17:57">asked Nov 09 '15 at 17:57</time> <a href="../../users/1228333/donovant" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1228333.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Donovant" /> </a> <div class="s-user-card--info"> <a href="../../users/1228333/donovant" class="s-user-card--link">Donovant</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">3,091</li> <li class="s-award-bling s-award-bling__gold" title="8 gold badges">8</li> <li class="s-award-bling s-award-bling__silver" title="40 silver badges">40</li> <li class="s-award-bling s-award-bling__bronze" title="68 bronze badges">68</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-32707590"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status "> <strong>0</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/32707590/initialize-one-controller-manually-multiple-times" class="question-hyperlink">Initialize one controller manually multiple times</a></h3> <div class="excerpt">I manually initialize my controller as follow: var body = angular.element(document.body); var injector = angular.element(body).injector(); var compile = injector.get('$compile'); var rootScope = injector.get('$rootScope'); var controller =…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/javascript" class="post-tag grid--cell" title="show questions tagged 'javascript'" rel="tag">javascript</a> <a href="../../questions/tagged/angularjs" class="post-tag grid--cell" title="show questions tagged 'angularjs'" rel="tag">angularjs</a> <a href="../../questions/tagged/ng-controller" class="post-tag grid--cell" title="show questions tagged 'ng-controller'" rel="tag">ng-controller</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Sep 22 '15 at 02:48">asked Sep 22 '15 at 02:48</time> <a href="../../users/276439/nate" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/276439.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Nate" /> </a> <div class="s-user-card--info"> <a href="../../users/276439/nate" class="s-user-card--link">Nate</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">7,606</li> <li class="s-award-bling s-award-bling__gold" title="23 gold badges">23</li> <li class="s-award-bling s-award-bling__silver" title="72 silver badges">72</li> <li class="s-award-bling s-award-bling__bronze" title="124 bronze badges">124</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <a class="s-pagination--item" href="../../questions/tagged/ng-controller_page=3" rel="prev" title="Go to page 3">Prev </a> <a class="s-pagination--item" href="../../questions/tagged/ng-controller_page=1" rel="" title="Go to page 1">1</a> <a class="s-pagination--item" href="../../questions/tagged/ng-controller_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/ng-controller_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/ng-controller_page=12" rel="" title="Go to page 12">12</a> <a class="s-pagination--item" href="../../questions/tagged/ng-controller_page=13" rel="" title="Go to page 13">13</a> <a class="s-pagination--item" href="../../questions/tagged/ng-controller_page=5" rel="next" title="Go to page 5"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>