angularjs-directive

Angular directive, binding click event to outside element not working

馋奶兔 提交于 2019-12-11 22:36:45
问题 I am trying to create a custom event for toggling with Angular. The directive is called toggleable. It sounds trivial at first, but tricky bit is that i want to be able to to use any button or link on the page for toggling. The code i have written is as below Directive 'use strict'; angular.module('onsComponents') .directive('togglable', function() { return { restrict: 'A', transclude: true, scope: { togglerId: '@', show: '@' }, link: function(scope, element, attrs) { if (!scope.togglerId) {

How can I call a directive function from outside?

两盒软妹~` 提交于 2019-12-11 22:13:58
问题 I have a directive that generates a list for me. This directive has methods for pagination. I would like to control this list using keyboard so that when I press left or right the list pages next or previous. Is there anyway I could do that? bellow there is my directive code: app.directive("gridview", function(){ return { restrict:'E', transclude: true, template:'<div><button ng-disabled="!hasPrevious()" ng-click="onPrev()"> Previous </button><button ng-disabled="!hasNext()" ng-click="onNext(

Angularjs directive TypeError: object is not a function

时光毁灭记忆、已成空白 提交于 2019-12-11 22:05:02
问题 I'm new at Angularjs... Just got mad making this to work: angular.module('app', ['ui.select2']).directive("selectCompany", function($timeout) { return { restrict: 'A', replace: true, template: '<input type="text" name="company_id" ng-model="companySelected" />', scope: {}, link: function (scope, element, attrs, ctrl) { $timeout(element.select2({ placeholder : "Buscar empresa", minimumInputLength : 3, allowClear : true, ajax: { url : 'http://' + window.location.host + '/ajax/module/company

AngularJS and JQuery UI Tabs

江枫思渺然 提交于 2019-12-11 21:46:29
问题 I've seen some samples of tabs with AngularJS, and very few about JQueryUI tabs with AngularJS, so I tried to create two directives to create the tabs container, and the tab items. Here is the sample code I've created: http://jsfiddle.net/davidzapata/tvq6w1g9/2/ HTML <div ng-app="biApp"> <div ng-controller="MyCtrl"> <h1>{{greeting}}</h1> <jqueryuitabs> <jqueryuitab id="tab1" title="Tab 1">Tab 1 content</jqueryuitab> <jqueryuitab id="tab2" title="Tab 2">Tab 2 content</jqueryuitab> <jqueryuitab

Angular + Firebase + AngularFire Seed Directive ShowAdmin

守給你的承諾、 提交于 2019-12-11 21:25:17
问题 First, a wordy up-front description of my situation... My application is utilizing Angular.js and AngularFire to run without a backend. I am using Firebase Simple Login for authentication, and the AngularFire-Seed project provides a simple way to get auth info. To create an administrator in the application, I'm storing a user's uid in /admin in my Firebase, so I can check if /admin/simpleLogin:45 exists, for example, to see if the user with uid simpleLogin:45 is an admin. I'm trying to create

how to store and retrieve data in angular js?

不想你离开。 提交于 2019-12-11 21:14:28
问题 can you please tell me how to store data permantly (example local storage)and retrieve data .I want to store data so that I get again .I am doing client side programing ? I google it it say there is persistance.js will do that ..can we use that ?I am try to make a simple example to store data but not able to that .I want to save list of name of student and class. here is my plunker : http://plnkr.co/edit/cLTIJfETGYENQyEdsu94?p=preview // Code goes here var app = angular.module('appstart', [

How to add icon on row in ionic framework?

懵懂的女人 提交于 2019-12-11 20:47:00
问题 I am trying to make simple demo in ionic. I have one footer having one icon ion-compose (bottom left icon). When I click on that icon it show a pop up screen I enter name in text field and press save button. Then it generates a row which have same text as written in textfield of popup screen. I need to add icon buttons on row (like delete button, edit button). Can we add icon on dynamically generated row as I did in footer (bottom left ion-composer)? Please add ion on row Here is my code http

Datatable filter logic change not reflecting

白昼怎懂夜的黑 提交于 2019-12-11 20:39:25
问题 I am trying to change the filter logic in angular datatable export class FilterPipe implements PipeTransform { keys = []; transform(items: any, args: string): any { console.log('Datatable test'); if (items != null && items.length > 0) { let ans = []; if (this.keys.length == 0) { this.keys = Object.keys(items[0]); } for (let i of items) { for (let k of this.keys) { if (String(i[k]).toLowerCase().indexOf(args.toLowerCase()) >= 0) { ans.push(i); break; } } } return ans; } } } I kept a console

Chaining directive within directive in angularjs

你说的曾经没有我的故事 提交于 2019-12-11 20:37:23
问题 I wished to create something like the following using custom directive. I am able to get the "Categories" section, but not the "breadcrumb" part. Using ng-repeat in the breadcrumb directive, does not work. I can observe the ul of the breadcrumb but the li element are not appended to the ul . Following is my fiddle and for some reason the code works on my side does not work on jsfiddle. But I have placed it just to give some idea. Fiddle <div ng-controller="sampleCtrl"> <tree src="categories">

Nested directives don't work as expected

二次信任 提交于 2019-12-11 20:15:29
问题 I have a generic directive genericDirective that is supposed to choose another specific directive type1 directive if obj.type == "type1" type2 directive if obj.type == "type2" HTML <div ng-controller="MainCtrl"> <div class="genericdirective" ng-repeat="obj in someArray"></div> </div> Javascript var app = angular.module("myApp", []); app.controller("MainCtrl", function ($scope) { $scope.someArray = [ {type:"type1",title:"lorem"}, {type:"type2",title:"ipsum"}, {type:"type2",title:"dolor"} ]; })