FAQ Database Discussion Community


Angular Contoller is not defined

angularjs,angularjs-controller
Error: [ng:areq] http://errors.angularjs.org/1.3.15/ng/areq?p0=homeController&p1=not%20aNaNunction%2C%20got%20undefined I am getting the above error Controller.js angular.module('app').controller('homeController', function($scope) {}); app.js var app = angular.module('app', ['base', 'ngRoute', 'routeResolverServices']); angular.bootstrap(document, ['app']); return app; Please help me to solve this issue...

Angular controller error: 'Controller is not a function, got undefined'

javascript,angularjs,angularjs-controller
I am getting the following error in my angular application: Error: [ng:areq] Argument 'HomeController' is not a function, got undefined. My JS and HTML are below. This is actually a part of an ionic/cordova project, but here is a simplified jsfiddle in which I encounter the same problem. My JS:...

Dynamic update of ng-include through controller and directive Angualar-js

angularjs,angularjs-directive,angularjs-controller,angularjs-ng-include
Left side of the page sometimes have just info, sometimes it has side menu. When there is side menu, the content of main section depends on the option clicked. Since the same kind of layout is used in multiple places, I created nested directives for the link/info side menu. I...

AngularJS - passing variable to scope (from directive to use it in controller) not working

angularjs,angularjs-directive,angularjs-scope,angularjs-controller
I would ask for some help and explanation on the given issue. It seems like I can not pass variable to scope from directive to use it in controller, variable is called caret_position. Please see below code. Controller var myApp = angular.module('myApp', []); myApp.controller('Composer', function Composer($scope, $http) { // getting...

Can we access user input value in customfilter.Trying to access user input number from controller or directly in customfilter

javascript,angularjs,angularjs-scope,angularjs-controller,angularjs-filter
I am new to angular js .Here I am trying to filter data based on the temperature by subtracting the user input(x) from the currentTemp variable.But not sure if i could access the user input value in custom filter.I am planning use same thing on date later on.For now this...

Can an Angular controller bind to multiple parts of a web page?

javascript,html,angularjs,angularjs-controller
Suppose that I've written a web page that requires the user to key in data into forms. Suppose that there are two parts of the page that are completely separate in the DOM, yet are logically related. I need to bind them to a single model. The first (bad) solution...

Communicate to another, specific controller

angularjs,angularjs-service,angularjs-controller
I'm a bit lost... I'm quite new to Angular and writing a small app for practicing. I've two views with a table and each view has it's own controller. The tables use some equal functions, like edit, save... To avoid duplicate code I've put these functions in a seperate controller....

Update Angular ion-view in another controller

angularjs,angularjs-controller,angularjs-factory
Im new here on stackoverflow and new to AngularJS. Im trying to build a Ionic app, and here is my problem. I would like to change the date in one template(date.html), using Controller: DateCtrl, and change the GEO location in another template(geo.html), using Controller: GEOCtrl. And when I change the...

Add new text box on click of a button in angular js

angularjs,angularjs-ng-repeat,angularjs-controller
How do I add new text box when submit button is pushed. This is what I have tried and I know there's some thing wrong. I am still new to angular js. Example: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example - example-ngController-production</title> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script> <script> angular.module('controllerAsExample', []).controller('SettingsController1', function ($scope)...

Passing values to ng-model from ng-repeat

angularjs,angularjs-scope,angularjs-ng-repeat,angularjs-controller
I have a form that passes its inputs to ng-model before storing to the database. One of which is a dynamic value (pre-generated code) that is taken from its database table. <div class="form-group" ng-repeat="codes in response | filter: {branch: formData.branches.alias, taken: 0} | limitTo: 1"> <input class="form-control" type="text" name="code" ng-model="formData.code"...

Binding issue in AngularJS

javascript,angularjs,angularjs-scope,angularjs-controller,angularjs-controlleras
I am trying to bind from a http get request. The http get is returning true or false. I have tested the get and it is returning properly. When I run the code below, it shows the alert(1111) properly also. However, when I'm trying to change the button text, nothing...

Why wouldn't you use explicit annotations when defining controllers in AngularJS?

javascript,angularjs,dependency-injection,angularjs-controller
I am new to AngularJS and learning about the two styles of writing controller functions. It seems as though the only reason someone would not use explicit annotations is to save time, which doesn't seem like a good reason. And being able to minify/obfuscate code seems like a requirement I...

How to do load page in Angular JS?

javascript,angularjs,routing,angularjs-routing,angularjs-controller
How to load content on page by clicking on menu links? For example, there is menu: <a href="#">Personal</a> <a href="#">Contacts</a> Question is in how change template HTML in page for each link?...

AngularJS - Error: [ng:areq] Argument 'CustomersController' is not a function, got undefined

angularjs,angularjs-controller
Here is my view index.html: <!DOCTYPE html> <html ng-app> <head> <title>Iterating Over Data</title> <link href="styles.css" rel="stylesheet" type="text/css" /> </head> <body ng-controller="CustomersController"> <h2>Customers</h2> Filter: <input type="text" ng-model="customerFilter.name"> <br><br> <table> <tr> <th ng-click="doSort('name')">Name</th> <th ng-click="doSort('city')">City</th> <th...

Function in AngularJS controller not being called

angularjs,angularjs-controller,angularjs-ng-click
I am trying to call a function from my AngularJS controller with the following code: Controller Code (function () { var hello = angular.module("helloApp", []); hello.controller("HelloCtrl", ["$http", "$scope", function($scope, $http) { console.log("in controller"); $scope.test = function() { console.log("in test function"); $http.get("/test").success(function(data) { console.log("success"); }) .error(function(data) { console.log("error"); }); }; }...

$http.get is undefined when $http is used outside angular code

angularjs,jasmine,karma-jasmine,angularjs-controller,angularjs-http
I am running jasmine unit test against a method which is outside angular controller. Running the jasmine throws the following error, TypeError: Cannot read property 'get' of undefined at testMethod Can anyone help me with fixing the above error. Thanks ! Test.js function testMethod() { var $http = angular.element('html').injector().get('$http'); $http.get('/testAPI/testCall').success(...);...

issue with Angularjs 1.3 new controller as syntax and directive

angularjs,angularjs-directive,angularjs-scope,angularjs-controller
Till now I am using Angularjs 1.2 normal global controller syntax but now I need to move 1.3 and use the new controller as syntax and avoid global declarations as our requirements. Now I am in the process of learning it. But some how I am failing to make it...

set/get data in service from controllers

javascript,angularjs,angularjs-service,angularjs-controller
Just trying to figure out how some of this works so I want to input a number in a view then have the controller set that data in the service and switch views. Then the controller for the next view should get that number from the same service and eventually...

AngularJS — Passing object/object property to be $watched into $scope.$watch

javascript,angularjs,angularjs-scope,angularjs-controller
Deep watching on large objects a performance killer—so I'd like to be able to pass a dynamic object/property into the watchExpression parameter of the $scope.$watch function, whenever you invoke an action that changes that particular object or property. I also have a bunch of different objects and don't want to...

AngularJS Controller instance method

angularjs,angularjs-controller
I have an angular js controller that I am writing in a way so other controllers can inherit from it. Instead of defining the function as a single one in the angular's controller function I am writing it in the following way: function SomeCtrl($scope) { this.some_field = "1234"; this.scope.externalMethod =...

Assigning controller to a form template with $routeProvider in AngularJS

javascript,angularjs,angularjs-controller
I'm building my first angular app, starting with a simple login form. I load the form from a partial, however when I try submitting the form, nothing is logged to the console, i.e. I assume my authenticate() method is not called. I have the following definition for my app.js: 'use...

Communicating between controllers in AngularJs

angularjs,angularjs-service,angularjs-controller
I have a simple question: what's the best ('cleanest', 'scaleable') path one should go when it comes to interact between (let's say) two controllers. Would that be to define a service and watch that service's return-value in order to react? I setup a simple example here, where I watch the...

Running AngularJS test for controller after changing $scope to this

angularjs,angularjs-scope,karma-jasmine,angularjs-controller
I am following the angularjs tutorial here : https://docs.angularjs.org/tutorial/step_02 My original controller: var phonecatApp = angular.module('phonecatApp', []); phonecatApp.controller('PhoneListCtrl', function ($scope) { $scope.phones = [ {'name': 'Nexus S', 'snippet': 'Fast just got faster with Nexus S.'}, {'name': 'Motorola XOOM™ with Wi-Fi', 'snippet': 'The Next, Next Generation tablet.'}, {'name': 'MOTOROLA XOOM™', 'snippet':...

initializing ng-app with name disables varibles initialization

javascript,angularjs,angularjs-directive,angularjs-controller
With following: <div ng-app="" ng-init="show_login=false;count=0"> <button> ng-click="show_login=!show_login;count=count+1">INSPIRE</button> <form ng-show= "show_login"> Username <input type ="text"> <br> Password <input type = "password"> <p> {{count}} </p> </form> </div> My form works fine but when i assign name to ng-app module , form is not working. <div ng-app="demo" ng-init="show_login=false;count=0"> <button>...

Testing variable binding using Controller As syntax

angularjs,jasmine,angularjs-controller
I'm trying to test a simple form controller using the controller as syntax. What I want is to be able to pass in different field values to each unit test and see how the controller reacts. The code I'm using as an example: Controller: angular.module('auth').controller('LoginFormCtrl',['AuthService',function(AuthService) { var self = this;...

Pass variable from directive to controller

javascript,angularjs,angularjs-directive,angularjs-scope,angularjs-controller
I have this directive definition and want to pass currentScriptPath to the TestController. How do I do that? (function(currentScriptPath){ angular.module('app', []) .directive('test', function () { return { restrict: 'E', scope: {}, templateUrl: currentScriptPath.replace('.js', '.html'), replace: true, controller: TestController, controllerAs: 'vm', bindToController: true }; }); })( (function () { var scripts...

View does not reflect the data from $http.get(inside an angularjs controller)

angularjs,angularjs-controller
Im using AngularJS and I'm creating a controller which is connected to the view. This controller gets data from the server every 10secs and the idea is to display/show the data to the client. My controller is shown below. (function() { var app = angular.module('clock-widget-directives', []); app.controller('ViewClockController', function($scope, $http, $interval){...

I am trying to understand AngularJS's controllerAs syntax

javascript,angularjs,angularjs-controller
However after writing up a few examples to play around with the controllers would not load. I was getting an error: firstController is not a function After some googling I found that Angular 1.3.x no longer supports global controllers. All the examples I have seen of the new way of...

AngularJS — Explicitly returning a value from a controller

angularjs,angularjs-controller
I ran into the codeblock below the other day, and I am trying to figure out why exactly the author may have chosen to return init(); rather than doing something like $scope.init = function() {...}; And calling it with an ng-click, or something or other. Here's the code: myApp.controller("PlaylistCtrl", [...

Setting up watches in Angular controller vs. more complex template

angularjs,angularjs-directive,angularjs-scope,angularjs-controller
I'm looking for the proper place to put some presentation-related logic in Angular. I'm new to Angular, so I'd like some general guidance as to the proper Angular way to approach a problem like this. I have an object that encapsulates a user's sort choices for a list of data...

AngularJS popover bind to controller variable

angularjs,twitter-bootstrap,angularjs-directive,angularjs-scope,angularjs-controller
I'm trying to create a popover and load content into it directly from a controller. I can succesfully bind flag into the tooltip using a directive from this answer, but the popover keeps showing the initial value of flag, even if I change flag's value with the second button. The...

Inheritance w/ Angular's 'Controller As' vs. $scope

angularjs,inheritance,angularjs-scope,angularjs-controller
tl:dr; I want to consider the 'controller as' approach to simplify my inheritance process however I see some pitfalls around dependency injection and use in directives. preface I've been working on a pretty big Angular application for the last 6 months. I come from a more OOP language background but...

Angularjs Uncaught Error: [$injector:modulerr]

javascript,angularjs,angularjs-scope,angularjs-controller,angularjs-1.3
I am learning angularjs and i am not able to figure out whats wrong with this simple code. It seems to look fine but giving me following error. **Error**: Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=app&p1=Error%3A%20…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A17%3A381) And before adding ng-app="app" (I was just keeping it as ng-app) it was giving me following errors....

How to get Angular controller members in non-Angular code?

angularjs,angularjs-controller
I'm sticking my toe in the Angular ocean. I have a web application that uses jQuery to allow the user to interact with the application using input forms and buttons. I'm learning Angular and as an exercise, I decided to try to write code to do this with Angular instead....

Does polluting the $scope object affect performance?

angularjs,angularjs-scope,angularjs-controller
I have a controller where the $scope object has been used to store methods and values that are only used locally within the same controller. There is a lot of this going on: $scope.foo = 'something'; $scope.bar = 'something else'; ... and so on. None of these values are used...

AngularJS passing lastTime to a service to display only recent posts

angularjs,angularjs-scope,angularjs-service,angularjs-controller
I am not sure if I am going about this the right way but what I want to achieve is a Twitter feed like effect. I have a Statuses page, on the first page load it will get all the statuses and after then it will only display the updates...

my Controller is working fine but Directive is not

angularjs,angularjs-directive,angularjs-controller
ok, so this is my AngularJs Controller which have Directive as well. now when i run application the main page i design for this controller is working but when i tried to re-use it as directive then i cant see anything, the new HTML page is empty. AngularJS Controller: var...

What is the difference between these two angularjs controller definition

angularjs,angularjs-controller
I don't understand the difference between these two types of angularjs controller definition, i have tried following codes and found both working myApp.controller('GreetingController', ['$scope', function($scope) { $scope.greeting = 'Hola!'; }]); myApp.controller('GreetingController', function($scope) { $scope.greeting = 'Hola!'; }); ...

Same “controller as” name in angular js directive breaks function in parent controller

javascript,angularjs,angularjs-directive,angularjs-controller
I've a controller with some items for ng-repeat and each item should get a random color so I use ng-style with a function in that controller called randColor(...). app.controller('TestController', function() { var vm = this; vm.items = [ { name: 'item 1' } , { name: 'item 2'} ]; vm.randColor...

Get value from Directive into Controller

angularjs,angularjs-directive,angularjs-scope,angularjs-controller
So I have this filter directive: app.directive('filter', function(){ return { restrict: 'E', transclude: true, scope: { callFunc: '&' }, template: ' <div>' + ' <div ng-transclude></div>' + ' </div>', controller: function($scope, $element, $attrs){ this.getData = function() { $scope.callFunc() } } } }); app.directive('positions', function(){ return { require: '^filter', scope: {...

Unable to boradcast event from parent controller in angularjs

angularjs,angularjs-scope,angularjs-routing,angularjs-controller
I have a two controller having parent-child relationship: This is the route for parent controller: angular.module('app') .config(function ($stateProvider) { $stateProvider .state('data-show', { url: '/data', templateUrl: 'app/data.html', controller: 'DataCtrl' }); }); This is the HTML for parent controller: <div class="block-header"> ... ... <div ng-include="'components/child_page.html'"></div> </div> Code for parent controller: angular.module('app') .controller('DataCtrl',...

Angular Structure Incorrect Somewhere

c#,angularjs,visual-studio-2012,angularjs-controller,angularjs-controlleras
All i am trying to do is call my back-end through an ng-Click and $http.get. I am then trying to set the value of the item i get to show up in my html. Here is my structure. Not really getting any errors so any information on how to see...

Can I require a controller, in a directive, set with ng-controller?

angularjs,angularjs-directive,angularjs-controller
I have (sort of) the following html: <div ng-controller="MyController"> <my-sub-directive></my-sub-directive> </div> how the controller looks is not important: app.controller("MyController", function($scope) { $scope.foo = "bar"; }) and my directive looks like this: function mySubDirective() { return { restrict: "E", templateUrl:"aTemplate.html", require: "^MyController", link: function($scope, element) { } }; } app.directive("mySubDirective", mySubDirective);...

Controller not a function got undefined error message angular js

javascript,angularjs,angularjs-controller
I am a beginner with MEAN Stack development. I was trying out to play around with some angular stuff but got completely messed up the the controllers. Here is my main html file <!--main.html--> <html> <head> <title>Chirp</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script> <script src="javascripts/chirpApp.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> <link...

Controllers and directives, precedence

angularjs,angularjs-directive,angularjs-service,angularjs-controller
I've been with Angularjs a few days and I'm struggling with a few aspects of it. I'll do my best to try and explain what the issue is, and I'd really appreciate any help anyone can give me about it. My situation (simplified) is this: I have a service which...

How can I add a directive from a module to a controller?

angularjs,angularjs-directive,angularjs-controller
I've seen directives created like so: angular.module('docsSimpleDirective', []) .controller('Controller', ['$scope', function($scope) { $scope.customer = { name: 'Naomi', address: '1600 Amphitheatre' }; }]) .directive('myCustomer', function() { return { template: 'Name: {{customer.name}} Address: {{customer.address}}' }; }); The myCustomer directive is now on the Controller controller. If I define my module and controller...

How to use Ionic Popup with scope in Controller As syntax?

javascript,angularjs,ionic,angularjs-controller
I have an Angular controller setup using Controller as syntax and I need to create an Ionic Popup with a bound data field from one the methods. What I can't figure out is how to set the scope of the popup for the data-binding. I found this example but it...

Angular Js : Button click to get data from two controllers and showing it in third

angularjs,angularjs-scope,angularjs-controller,angularjs-factory
I am new to AngularJS. i am having a following functionality where i am having a FirstName field and LastName Field(in two Different Controllers) and then on the click of a button i want to show FullName(First Name + Last Name) in a third Controller . Please Suggest me how...

Injecting a Angular service into controller results in $injector:unpr error (using AngularBooter)

angularjs,angularjs-service,angularjs-controller
I am using the AngularBooter for Angular in my app. Here is my code: emp.boot(); emp.services.SocialService = ['$http', '$q', function ($http, $q) { var deferred = $q.defer(); $http.get('/api/feed').then(function (data) { deferred.resolve(data); }); this.getStatuses = function () { return deferred.promise; } }]; emp.controllers.StatusesController = ['$scope','SocialService', '$interval', function($scope, SocialService, $interval) { var...

How to call function in controller in angularjs?

angularjs,angularjs-scope,angularjs-controller,angularjs-ui-router
If in url parameter id is available then i want to call function. .controller('repeatCtrl', function($scope,$state,$stateParams) { if($stateParams.id != ""){ //Here i want to call itemDetails function $scope.itemDetails(id); }; $scope.itemDetails = function(id) { // function body here!! alert(id); }; }) ...

List dependencies injected

javascript,angularjs,angularjs-controller,angularjs-module
Is there a way to know what dependencies were injected into my Angular module? angular.module('myModule', [ 'ui.bootstrap' ]) .controller('myController', [function () { // var dependencies = Magic.dependencies; // console.log(dependencies); }]); ...

Need to stop ongoing operation when controller becomes background (or invalid)

angularjs,controller,routing,angularjs-routing,angularjs-controller
I'm writing my first AngularJS application. The landing page has two links #/view1 and #/view2. Every link will call individual controller to render <div ng-view></div> individually. The view1Ctrl will fetch data from server periodically. I can see ajax call in console every X seconds. Now I click #/view2, the app...

Using controllerAs syntax in Angular, how can I watch a variable?

javascript,angularjs,angularjs-controller
With standard controller syntax in AngularJS, you can watch a variable like: $scope.$watch(somethingToWatch, function() { alert('It changed!'); }); Using the controllerAs syntax, I want to react to this change in an active controller. What's the easiest way to do this? More detail, if it helps. I have one controller in...

AngularJS: Controller inheritance using call (or apply)

angularjs,angularjs-controller,angularjs-factory
This is something I discovered when trying to make my controllers more reusable. app.factory('BaseController', function(myService) { return function(variable) { this.variable = variable; this.method = function() { myService.doSomething(variable); }; }; }) .controller("ChildController1", function($scope, BaseController) { BaseController.call($scope, "variable1"); }) .controller("ChildController2", function($scope, BaseController) { BaseController.call($scope, "variable2"); }); And now I can do something...

Use 1 method for all the function short down to one function in angularjs

javascript,angularjs,angularjs-scope,angularjs-controller,angularjs-factory
Hello i am trying to create an angular app. So here is one function which i am using very often in most of my controllers. Can i make one function or one method so can i can use this function everywhere just like we do in PHP. Here is the...

Updating directive based on change in service value AngularJS

javascript,angularjs,angularjs-service,angularjs-controller
I have a basic app currently that has a list of names in a sidebar nav populated from a json call to my server. When the user clicks on a name in the sidebar, it updates the nameService to the name clicked on by the user. When the nameService gets...

Angularjs Cannot get the correct data from a service in a controller

angularjs,cordova,ionic-framework,angularjs-service,angularjs-controller
I try to build a mobile app with Ionic/Angular/Cordova, and I have some problems with a service :) My code looks like this : SERVICE: 'use strict'; angular.module('MyDemoApp.services').service('ImageService', function($cordovaCamera, $cordovaFile) { // 1 //$scope.images = []; this.addImage = function (method){ var imageDetails ={'name':'', 'src':'' }; // 2 // Set the...

Submitting Form in AngularJS and MVC 4

angularjs,asp.net-mvc-4,angularjs-controller,angularjs-factory
I am new to AngulaJS, and I am trying to do as many examples as I can. I found an example online that works pretty well except for the registration part. I tried to register a user; it did not submit the form, and there was not an error message/exception....

controllerAs with directives and isolated scope

angularjs,angularjs-directive,angularjs-controller
I want to create a ok / cancel button set where the developer can change the label I have the following directive angular.module('myApp') .directive('myButtons',function(){ var ctrl = function ($scope) { var controller = this; }; return { replace: true, restrict: 'E', scope: { cancelLabel: '@', saveLabel: '@', save: '&', cancel:...

TypeError: (intermediate value)(intermediate value).success is not a function (angular)

javascript,angularjs,angularjs-scope,angularjs-controller,angularjs-http
I have difficulties understanding this error... I dont quite understand why its not a function.... angular.module('mkApp').factory('mkService', function ($http, $log) { function getLookUp(successcb) { $http = ({ method: 'GET', url: 'api/Entries/' }).success(function (data, status, header, config) { successcb(data); }). error(function (data, status, header, config) { $log, warn(data, status, header, config); });...

On view call other controllers http request getting triggered automatically

angularjs,angularjs-routing,angularjs-controller
I have a file "controller.js" Which has homeController and sectionController defined. in route.js when('/home', { templateUrl: 'view/main/home.html', controller: 'homeController', access: { requiredLogin: false } }). when('/section/:menu', { templateUrl: 'view/main/section.html', controller: 'sectionController', access: { requiredLogin: false } }) but when call to /section/ is made. I could still see $http request...

Breaking change from between AngularJS 1.2 and 1.4?

javascript,angularjs,angularjs-controller
The following code works in Angular 1.2 but breaks in 1.4 with error Error: [ng:areq] Argument 'MyController' is not a function, got undefined. The code comes from the book "ng-book", and a live working example can be found here: http://jsbin.com/uHiVOZo/1/edit?html,output. What changed? <body> <div ng-controller="MyController"> {{ clock }} </div> <script...

How to keep entered data of page1 after navigating back from page2 in AngularJS

html,angularjs,angularjs-service,angularjs-routing,angularjs-controller
I have three pages with routing. If I entered some input and getting some result on first page, next I navigated to second page and finally I came back from second page to first page. Then I want to see the data what I entered previously and result also. Here...

Controller being called twice in Ionic (AngularJS)

javascript,angularjs,ionic-framework,angularjs-routing,angularjs-controller
In my angular project the user accepts a EULA then get automatically redirected to their dashboard, however, on this redirect the DashboardController seems to be being called twice, the DashboardController is being called on the route itself, I have checked to see if I have accidently called it again in...

Angular watching Service properties

javascript,angularjs,angularjs-service,angularjs-controller
Take the following plunk as an example: http://plnkr.co/edit/vKFevXhhSprzFvesc6bG?p=preview var app = angular.module('plunker', []); app.service('SomeService', ['$rootScope', function ($rootScope) { var service = { value: false } return service; }]); app.controller('MainCtrl', ['$scope', 'SomeService', function($scope, SomeService) { $scope.value = SomeService.value; //$scope.$watch(function () { return SomeService.value; }, function (data) { $scope.value = data; });...

How to initialize form as scope variable in controller

angularjs,angularjs-scope,angularjs-controller
I have a simple angular form <form name="myForm" ng-controller="myFormController"></form> and need to call $setPristine() to myForm in myFormController. What is the best way to initialize this form as a $scope variable? I tried $scope.myForm.$setPristine(); but it gave me: Cannot read property '$setPristine' of undefined Thanks in advance. EDIT From the...

AngularJs factory function undefined in controller

angularjs,asynchronous,angularjs-service,angularjs-controller,angularjs-factory
I used to make it work the exact same way before, and it's driving me crazy. I want to perform a $http GET call into a factory and then get back the result into the controller, to be processed. The factory (don't pay attention to the madness of the request...

Trigger $modal.open from app.js

javascript,angularjs,angularjs-scope,angularjs-controller,angularjs-provider
My app.js looks something like this. I need to handle the AJAX errors globally. This code works fine if I were to use only console.log. However, I need to trigger a modal dialog by using $modal, but not sure how to implement that. Any help is appreciated. Thank you! define(['jquery','angularAMD',...