angularjs-directive

AngularJS ng-repeat jQuery find returns only one element

泪湿孤枕 提交于 2020-01-03 05:37:27
问题 I am developing my first AngularJS app, and came across this problem with jQuery find function. Basically what I am trying to do, is that I have an custom HTML component . It contains list of buttons using ng-repeat directive. Each has it's own ng-click listener, and in it's callback I want to find all app-item elements, but sadly it only returns me the first one. I think this is the case I should use link , but I cannot come with it myself. Part of app-screen.html: <div> <div ng-repeat=

angular.js - evalAsync not called

旧巷老猫 提交于 2020-01-03 05:15:22
问题 on the following jsFiddle i demonstrate a problem that makes me ponder. It stems from the need to send a system wide event to all scopes, telling them that the system has finished bootstrapping. In order to do that, i got the rootScope after bootstrapping, and called its evalAsync. Alas! its not executing. see here: http://jsfiddle.net/cusrC/8/ angular.element(document).ready(function() { angular.bootstrap(body, ['app']); var ngInjector = angular.injector(['ng']); var rootScope = ngInjector

AngularJS, nested controllers from variable

最后都变了- 提交于 2020-01-03 05:06:17
问题 Generally, what I want to do, is to initialize nested ng-controller inside ng-repeat using variable. JSFiddle JS angular.module('app',[]) .controller('main',function($scope){ angular.extend($scope,{ name:'Parent Controller', items:[ {name:'nested2'}, {name:'nested1'} ] }); }) .controller('nested1',function($scope){ $scope.name = "Name1"; }) .controller('nested2',function($scope){ $scope.name = "Name2"; }); I want this: <div ng-controller="main" ng-app='app'> Nested: {{name}} <div ng

calling a directive method from controller

血红的双手。 提交于 2020-01-03 03:59:06
问题 I am creating a directive with angular and in that i am using kendo-window control. Now i want to open that kendo window on demand from controller. In simple words i want to call a method of directive from controller on button click. Here is my code sample sample.directive('workorderwindow', [initworkorderwindow]); function initworkorderwindow() { return { link: function (scope, elements, attrs) { }, restrict: 'E', template: "<div data-kendo-window='window.control' data-k-options='window

how to remove Unexpected request: GET data.json?

非 Y 不嫁゛ 提交于 2020-01-03 03:48:25
问题 I am trying to use $httpBackend to test my $http request ..i AM getting this error Unexpected request: GET data.json No more request expected here is my testing code beforeEach(inject(function($rootScope,$controller,appfactory,_$httpBackend_) { $scope = $rootScope.$new(); $httpBackend=_$httpBackend_; ctrl = $controller('cntrl', {$scope: $scope}); fac=appfactory; modeSpy= spyOn(fac, 'mode').and.returnValue('a'); })); it('test true value',function(){ expect(true).toBeTruthy() }) it('check

Angular Bootstrap Slider - on stop execute function

喜你入骨 提交于 2020-01-03 02:31:07
问题 I have the following code for creating a slider: <html ng-app="angular-bootstrap-slider-test"> <head> <title>Angular Bootstrap Slider test</title> <script data-require="angular.js@1.3.0" data-semver="1.3.0" src="//code.angularjs.org/1.3.0/angular.js"></script> <script data-require="jquery@*" data-semver="2.1.1" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="bootstrap.css" rel="stylesheet" /> <link href="bootstrap-slider.css" rel="stylesheet" /> </head>

Angularjs custom directive using http promise not binding with template

守給你的承諾、 提交于 2020-01-03 02:25:30
问题 I am new to angularjs and want to add new feature in existing code. But code is not working as expected. I know i am not doing it the right way. Please correct me where is the mistake. I don't know why controller is not used but directive is used in this approach? Here is my custom service and custom directive directive code. Service code: angular.module("quickquiz-builder").service("SettingsService", function ($http, $q) { return { /* Return deffered promise response */ get: function() { var

How to use jQuery Plugins when using Angular.js

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 14:02:37
问题 I've been trying to figure out how could i use a jQuery plugin when using Angular.js, right now i'm using Angular 1.4 , some questions i have are: Can i use the jQuery version that comes with Angular when using plugins? When do i need to use another version of jQuery when using Angular? Are there any consequences when using a different version of jQuery? How do i know what's the latest supported jQuery version Angular supports? When referencing the libraries in the html which i load first,

Unit Test Expect SpyOn Not Found

為{幸葍}努か 提交于 2020-01-02 13:30:14
问题 I have a directive (restrict A) that handles an event click, and calls a service based on a value. Directive: define(function () { 'use strict'; var myDirective = function ($rootScope, myFactory) { return { restrict: 'A', scope: { _myValue : '=value' }, link: function(scope, element, attrs) { element.bind('click', function() { if (scope._myValue === 'red') { myFactory.red(); } if (scope._myValue === 'green') { myFactory.green(); } if (scope._myValue === 'black') { myFactory.black(); } }); } }

angularjs custom directive conditional templateUrl via attribute

孤人 提交于 2020-01-02 09:32:39
问题 I am trying to load conditional template urls via attributes, my directives is as follows. The directive is in a ng-repeate and when box.key == 'experiences' the expression is returning education-form.php and not experiences-form.php. <div multiple-form directive-data='directiveData' template-url="box.key == 'experiences'? 'experiences-form.php':'education-form.php'" item="item" forms="forms" form-name="{{box.key}}{{item._id}}" onsave="updateMultipleUser(box.key, item._id, $data)" onreset=