angularjs-controller

Ng-Click not firing

隐身守侯 提交于 2019-12-13 01:07:00
问题 whenever I click my submit button nothing happens, currently all I want it to do is print out the username and password to test there bindings. And I am able to talk to the controller and print out hard coded message that I made in the controller, it seem's that the ng-click doesn't fire on that method. Any help would be great, Thanks :D <section id="register-view" class="mainbar"> <section class="matter"> <div class="container"> <div class="row"> <label>{{vm.message}}</label> <form class=

Getting AngularJS Error: “[$rootScope:inprog] $digest already in progress” without a manual $apply

六月ゝ 毕业季﹏ 提交于 2019-12-12 09:33:26
问题 Other posts on this error always include someone trying to $apply without using a safe apply, but that's not the case in my example. My function IS successfully returning the data I requested from the API, but I can't clean this bug and it's driving me nuts. Every time before the .success is called in my $http function I get "Error: [$rootScope:inprog] $digest already in progress" in the console. Below are my controller and service. Thanks! Here's my service including a function to post an

Angular bind service property to a controller scope

不想你离开。 提交于 2019-12-12 09:12:40
问题 I have 2 controllers using the same service, the first controller change the value of a property on the service, I need the second controller to know the property has changed to set the new value in his current $scope. I dont want to use broadcast, is there an elegant way to do this ? Thank you. 回答1: You could create an object in angular service,that will have various shareable properties in it. You could directly assign that variable with your controller scope variable. So that the reference

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

ぐ巨炮叔叔 提交于 2019-12-12 05:26:52
问题 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 snippets json data $http.get('data/snippets/default.json').success(function(data) { $scope.snippets = data; $scope.snippets.count = data.length; }); // adding

AngularJS Disabling Forms When Controllers are Created

孤街醉人 提交于 2019-12-12 04:37:51
问题 AngularJS disables (cannot submit) forms that do not have a specific action set: <form action=""> when you create a controller. It does not have this issue when creating directive or factories. You can see this in a plunk here: http://plnkr.co/edit/gWFRMKGO3FzZtOgs4VmW?p=preview Form is defined as: <form action="" method="post"> If you delete the starting on line 6, you will be able to submit the form. A simple solution is to define the action, but I'd rather not do this, as it is not

Angular module injection error

北战南征 提交于 2019-12-12 01:28:44
问题 I am trying to create a sample Angular app with .Net, just to get the idea how to connect two of them but I can not get rid of this injector::modulerr error. Tried variety of things, changing dependencies, removing empty brackets and so on but nothing changes. I have created plunker to keep this thread cleaner the link is below. http://plnkr.co/edit/5AHsUSrFib4dkiX6XjLY?p=preview I think the error keeps coming from this one angular.module('angularTest', ['ngRoute']).config(['$routeProvider',

Angularjs bad argument ng:areq error

怎甘沉沦 提交于 2019-12-12 01:13:13
问题 I'm getting this error when running my application. This error comes in only one controller. I have done other controllers in the same way but in this particular controller I get this following error. Argument 'questionAddCtrl' is not a function, got undefined Controller: ; (function () { 'use strict'; angular.module('app').controller('questionAddCtrl', ['$scope', '$http', function ($scope, $http) { $scope.data = { question: '', ans1: '', ans2: '', ans3: '', ans4: '', ans5: '', correct_ans: '

how to fire a controller method from another controller or directive?

女生的网名这么多〃 提交于 2019-12-11 23:56:13
问题 What I need is to show some values automatically when I process some data on another controller, but how can I fire my $scope.setOnController1 function on controller1 when the controller2 have ended to process my data automatically. JS FIDDLE http://jsfiddle.net/b2fCE/228/ Here is HTML the code <div ng-app="myApp"> <div ng-controller="myController1"> <button ng-click="setOnController1()">Force values(SECOND)</button><br/> <ul> <li><b>myController1</b> (values won't change)</li> <li>{

angularjs changing factory object shared between controllers

馋奶兔 提交于 2019-12-11 12:49:03
问题 Is it possible to update the scope variable that points to a factory object, after the factory object is updated? If there are 2 angular controllers which share a factory object, if one of the controllers changes the factory object, it is not reflected in the scope variable of the other controller. Ex: http://jsfiddle.net/zjm0mo10/ The result will be "Factory foo.bar is 555" instead of "Factory foo.bar is 666" var app = angular.module('myApp', []); app.factory('testFactory', function(){

Unknown provider: bProvider <- b

丶灬走出姿态 提交于 2019-12-11 11:43:34
问题 I have an AngularJS project with Directives and Controllers. After a while i got this error when I tried to run it: Error: [$injector:unpr] Unknown provider: bProvider <- b I have googled it and could not find any obvious solution, does anyone have a clue? Here is my directive: 'use strict'; var directives = angular.module('adminUiApp.directives.upload', []); directives.directive('uploadDirective',['$interval', function($interval) { return { restrict: 'A', replace: false, templateUrl: 'views