angularjs-scope

AngularJS : how to reflect a variable change in one directive into another directive while using ng-repeat

 ̄綄美尐妖づ 提交于 2019-12-10 11:02:31
问题 In first case : I implemented a directive directive2 that will change bar value which will also get reflected in directive1 . Here u can find the plunkr (1st case) In second case :I implemented a directive directive2 , with ng-repeat used along with this directive that changes bar value and this is supposed to get reflected in directive1 . Here u can find the plunkr for directive2 with ng-repeat (2nd case) How i expect it to work : i want the bar in directive1 to change according to the

Angularjs and jquery not working in my regular simple form

送分小仙女□ 提交于 2019-12-10 11:00:45
问题 I am learning Angularjs and I created simple form. Actually i am PHP developer so i preferred to use php as a server side scripting language. I am unable to submit the data to server, i tried so many methods but those are very complex if i am trying in standard method Angularjs is not working please check my code, and give me best method to work with angularjs, jquery and php. help me! angular.module("mainModule", []) .controller("mainController", function($scope, $http) { $scope.person = {};

Angular UI bootstrap pagination not working inside ui.bootstrap.tabs

浪子不回头ぞ 提交于 2019-12-10 10:59:41
问题 Angular UI bootstrap gives awesome solutions. Very unfortunately Pagination (ui.bootstrap.pagination) does not working inside Tabs (ui.bootstrap.tabs) DEMO http://plnkr.co/edit/mLBkDwEVY6SIh5oCyy0K?p=preview angular.module('mytodos', ['ui.bootstrap']).controller('TodoController', function($scope) { $scope.filteredTodos = []; $scope.currentPage = 1; $scope.numPerPage = 10; $scope.maxSize = 5; $scope.todos = [{ "id": 1, "date": "12-Jan-2015", "cheque_no": 11111, "withdraw": 126.01, "deposit":

$emit or $broadcast events from service and listen them in a controller (or several)

一个人想着一个人 提交于 2019-12-10 10:46:23
问题 I have coded a simple example where I want to emit/broadcast an event from a service and I want that event to be listened by a controller and change the UI, but I can't make it work and debugging the code it seems to stop in the listener but it doesn't execute the function. http://plnkr.co/edit/eglcq7zELLfKp86DYzOe?p=preview service: angular.module('ServiceModule', []). service('servicetest', ['$rootScope', function($rootScope){ this.test = function(){ $rootScope.$emit('testevent'); }; }]);

Why does two way binding sometimes work without using a dot in Angular?

独自空忆成欢 提交于 2019-12-10 10:07:40
问题 Consider this fiddle: Fiddle 1 When you select a date, you will notice that the text above it is not updating. This is because I had to use an object in my list, like this: Fiddle 2 (simplified). But, on the other hand, this does work, without a dot: Fiddle 3 Could someone explain what the difference is between fiddle 1 and fiddle 3? I've read about prototypical inheritance (unerstanding scopes), but I don't understand this behavior. Fiddle 3: HTML: <div ng-controller="MyCtrl"> Hello, {{name}

AngularJS only shows last Element in ng-repeat

梦想与她 提交于 2019-12-10 10:05:25
问题 I've got a strange behaviour using flexslider to render a bunch of galleries. As shown below I've got an array of several objects that conclude an array of images. When I "render" the galleries, all galleries appear but only the last one shows its images. On all galleries the indicator for the number of images in that particular, as well as the title and link, are correct, but the images are missing. Do I do something(/a lot) wrong here? Here is my code: $scope.galleries = [{title: 'gallery1'

scope.$watch in directive link function not getting called

南笙酒味 提交于 2019-12-10 03:46:44
问题 I have this factory, .factory('authentication', [function() { return { loginRequired: false }; }]); I have this controller, .controller('TopNavCtrl', ['$scope', 'authentication', function($scope, authentication) { $scope.login = function() { authentication.loginRequired = true; }; }]); and I have this link function in a directive, link: function(scope, element, attrs) { scope.show = false; scope.$watch(authentication.loginRequired, function(value) { scope.show = value; }); } When

Passing a binding to transcluded scope in component

时光总嘲笑我的痴心妄想 提交于 2019-12-10 02:45:02
问题 In AngularJS 1.5, I want to pass a binding from a component into the (multi-slot) transcluded scope - for a reference in the template (in either one specific or all of them - no either way is fine). This is for creating a generic custom-select list // Component .component('mySelect', { bind: { collection: '<' }, transclude:{ header: 'mySelectHeader', item: 'mySelectItem' }, templateUrl: 'my-select-template', controller: function(){ ..... } }); ... // Component template <script id="my-select

Inject $scope into filter (AngularJS)

♀尐吖头ヾ 提交于 2019-12-09 21:28:19
问题 What I'm trying to do: Im using a ng-repeat directive on an associative array, which I want to filter. The build in angular filter isn't working on associative arrays/hashes. Because of that, I'm trying to write my own filter (inspired by http://angularjs.de/artikel/angularjs-ng-repeat; it's in german, but the important code is below the headline "Beispiel 2: Filtern von Hashes mittels eigenem Filter" which means "Example 2: Filter Hashes with your own filter"). The ng-repeat: tr ng-repeat="

Difference between $scope and scope in angularjs

旧街凉风 提交于 2019-12-09 19:15:31
问题 I am new to angularjs. I would like to know what is the difference between $scope in angularjs Controller and scope in angularjs Directive. I tried to use scope in controller and I got the below error: Error: [$injector:unpr] Unknown provider: scopeProvider <- scope 回答1: $scope is a service provided by $scopeProvider . You can inject it into controllers, directives or other services using Angular's built-in dependency injector: module.controller(function($scope) {...}) which is shorthand for