angularjs-directive

Scroll event is not firing

爱⌒轻易说出口 提交于 2019-12-11 12:57:12
问题 I have to display more images as the user scrolls down the browser window.I have created a directive for that.But scroll event is not getting fired. app.directive('whenScrolled', function() { return function(scope, elm, attr) { var raw = elm[0]; elm.bind('scroll', function() { if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) { scope.$apply(attr.whenScrolled); } }); }; }); In LoadMoreItems, I am pushing two new items into the list: function LoadMoreItems() { $scope.temp = $scope

How to call collapseAll function on Angular UI tree?

人走茶凉 提交于 2019-12-11 12:45:49
问题 I am using the angular-ui-tree directive to show a tree in my AngularJS application. However, I would now like to collapse the tree. The documenation states that there is a function called collapseAll on the scope, but doesn't show an example of how to call this. Searching Google has brought up this issue where someone asks for exactly the same thing - unfortunately the linked answer results in a 404. What I don't get is: If this function is accessible via the scope of the ui-tree directive,

Can I make the transcluded scope of a directive be the same as the parents?

元气小坏坏 提交于 2019-12-11 12:40:50
问题 Say I have some html in angular : <input type='text' ng-model='stuff' /> {{stuff}} <button class="primary" ng-click='dothestuff()'>Do the stuff</button> With the following in the controller : $scope.stuff = 'arf'; $scope.dothestuff = function () { $window.alert($scope.stuff); }; This code will take I enter in the input and output it when I hit the button. All works well. But now I want to create a directive that wraps the elements in a div (so it shows in a dark grey background). I create a

dirPagination does not work (Angular JS pagination)

心已入冬 提交于 2019-12-11 12:08:37
问题 I am trying to use dirPagination but it does not work. See my code in action: http://plnkr.co/edit/18BxNhHRNyRoI17sBGQF?p=preview My code: <!DOCTYPE html> <html ng-app="myApp"> <head> <link data-require="bootstrap-css@3.1.1" data-semver="3.1.1" rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" /> <script data-require="angular.js@1.3.0-beta.5" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script> <script data

Using ng-repeat and ng-class in directive template causes an unknown error

余生长醉 提交于 2019-12-11 12:05:28
问题 I have a directive that turns a collection of items into a variable number of columns. The template for the directive uses ng-repeat to repeat the columns, and ng-class to apply a css class that turns the div into a column. The problem is angular throws errors when using the ng-class on same line as ng-repeat. Removing it fixes the issue, but the directive doesnt work properly. Now, this same functionality works fine in normal angular views, but not when used in a directive template. Here is

Angular Translate async timing issue with $translateProvider.useStaticFilesLoader

℡╲_俬逩灬. 提交于 2019-12-11 12:02:34
问题 I am using the excellent Angular Translate ( $translate ) directive/service to deal with multiple Locale Languages and since I have multiple locale files I use the convenient $translateProvider.useStaticFilesLoader to load my translation files through a structure of localeAbbr.json, for example en.json , es.json , etc... I built a Plunker to show my open source project and that project uses the locale through Git raw files (pointing to the actual Github repository, meaning not local to the

Angular animate parent div of ng-view using element insde ng-view

拜拜、爱过 提交于 2019-12-11 12:00:34
问题 Is it possible to css animate a div (background-color) that is outside the ng-view, using a directive on a $state inside the ng-view? The ng-view has css animations for the routing. If I do not animate the div then the ng-view anims work fine, but.. If I add animation classes to the div(bgId) then the routing anims do not fire. Here is a sample of html: (Button added as example - would normally be in the template pages eg. home.html / login.html ) <body ng-app="app" ng-controller="MainCtrl">

ng-repeat with tables in Angular JS and directives

大憨熊 提交于 2019-12-11 11:56:28
问题 I am trying to build a responsive data table using Angular with a directive and ng-repeat. I have managed to get the ng-repeat to work with tables: http://jsfiddle.net/raff77/Asb8k/ {} I am now trying to get it to work with a directive and the ng-repeat does not work. http://jsfiddle.net/raff77/uwGXb/3/ {} Is there a way to get the ng-repeat to work with your directive or should you build that into your directive. Notice I have built out a solution to add the rows as strings then html but i

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

required on custom directive select

谁都会走 提交于 2019-12-11 11:35:05
问题 I have created my own select dropdown using an unordered list and ng-repeat. The problem with this directive is that it does not work as a normal select/input/textarea where you can use required when using it in a html form. So how do I implement the option required/ng-required (as directive) with validation on a custom directive? Should I use an own implementation of the validation? dropdown.html <!-- displayed text on the select --> <div class="title" ng-class="{'placeholder': !hasSelected(