0
votes
0answers
3 views

is it possible to get all directives of one type in controller in angularJS?

I have a view which contains 20 instances of the same directive, directives are quite big and customizable. I want to be able to list all of those directives dynamicly, so i dont have to create new ...
0
votes
1answer
13 views

update directive from service

I would like my directive to be updated as soon as my model in the service get modified. I can not achieve it yet: service: function pickerService(){ // picked elements // do ...
0
votes
1answer
17 views

angularjs service scope issue after directive event listener callback

I am trying to use an event listener in my angular directive along with a service. I am having a scope issue as I want 'this' to refer to my service's 'this'. Right now, in my service, 'this' ...
0
votes
1answer
25 views

Use ng-show on a custom replace directive does not show or hide

I am having an issue with getting ng-show (or ng-hide) to work on a custom directive. It is working just fine on normal HTML elements. I made up a very simple example that shows the issue: <div ...
0
votes
1answer
21 views

How to set closest form name from inside directive

I want to set the name of form inside my directive. But unable to do so as I get an error TypeError: undefined is not a function. Can you help me fix this? Here is the fiddle HTML: <div> ...
1
vote
0answers
22 views

Angular Same Directive for Slightly Different Partials?

I'm building a web app that has the same layout pattern used over and over, however some parts of the app are slightly different. Part of me feels I could wrap these all into the same directive but ...
0
votes
2answers
18 views

$filter with custom function in angular

How I can create a $filter with custom function to determining if match ? This is a json sample with structure: $scope.routes =[ { "id": 0, "name": "Rosa Barnes", ...
0
votes
0answers
14 views

Angular: Proper way to implement a custom directive's visibility

I'm currently working on a new custom directive which will transclude some HTML around the element you've called it on. This means however that if you have a ng-show directive as well on the element ...
0
votes
2answers
34 views

angularjs directive controller $element

i see angularjs highly suggested not to do any dom manipulation in the controller, only setting the state of the scope, example pulling data from ajax etc, https://docs.angularjs.org/guide/controller ...
1
vote
1answer
29 views

Why is the Angular filter running twice?

So here is some simple sample code I setup from an example today while I was learning Angular. jsFiddle link Couple questions: How does it know to run categoryFilterFn. I'm guessing anything ...
0
votes
2answers
18 views

Select in directive with transclude not changing parent scope

Fiddle: http://jsfiddle.net/zorro/U8HpP/2/ Below code does not work. If I remove the transclude and template, it works just as intended. What am I missing? <div ng-app="example"> ...
0
votes
2answers
14 views

Generate dynamic form input fields and collect field data in an array

I am stuck with this little task. I need to generate form input fields dynamically by clicking 'add' button on the form. The form is supposed to create DB table schema. So every input field is a DB ...
0
votes
1answer
15 views

How to move DOM to rootElement in directive (angularjs)

I have a directive which has its template but part of it should always be appended to $rootElement. So wherever user put this directive in app's html part of it must reside as the last child of ...
0
votes
0answers
17 views

Integrate Google Earth JS API with AngularJS

I am rather new to angular, and trying to integrate it with google earth's javascript API. I have done some work with on both, but never try to use them together. My motivation is to use the google ...
0
votes
1answer
20 views

In Directives Apply different css template while appending element

I need to design dynamic Menu , menu items will be loaded from json . and when menu clicked i want to apply different template on them . I was palnning to use Directives but i wonder how can i use ...
0
votes
1answer
29 views

Searching for children elements with a particular directive AngularJS?

I am writing a directive with AngularJS, the directive is restricted as a attribute, which seeks to manipulate some of the child elements of the element. So far I'm selecting the elements I want to ...
0
votes
1answer
13 views

passing an array to custom directive in angularjs

I have the following directive var notInModule = angular.module('ui.notIn', []); notInModule.directive('notIn', function() { return { restrict: 'A', require: 'ngModel', ...
1
vote
1answer
29 views

AngularJS HTML data object

How can I have an attribute with it's data being an object? I want to set the data to two indices: <div ng-repeat="shift in schedule.shifts"> <div ng-repeat="tasks in shift" ...
1
vote
1answer
15 views

Utilize ng-include with raw (or compiled) HTML versus a template URL?

Say I've got a template that contains an element with an ng-include directive: <div ng-include src="'templates/top-promo-content.html'"></div> I'm attempting to streamline all of our ...
0
votes
0answers
13 views

Trying to get a string from Angular UI Modal via resolve object

I'm using the Angular UI modal directive: http://angular-ui.github.io/bootstrap/ I'm trying to pass a string from my modal open() function to my modal controller via the resolve object. I feel like ...
0
votes
1answer
11 views

two ng-submit events for validation on two forms in one html page

I have two forms 'Signup' and 'Login' in one html page using only one controller in angularJS(Something similar to facebook login page). Using ng-submit event for validation for both of them, ...
0
votes
1answer
19 views

ng-valid-pattern for empty string while regExp.test(“”)==false

I have <input type="url">, but angularJS things that the pattern is valid even if it is empty. Everithing is in the demo bellow. Demo
0
votes
1answer
18 views

Can a custom AngularJs directive be written inside a partial

I am new to AngularJs. Want to check if I can have a custom directive inside a partial file? If yes, then how many times the link function gets called when the partial is mapped to the data-ng-view on ...
1
vote
0answers
17 views

Datefield compare and validate in Angularjs

I'm looking for a way to validate two input datefields in my form. I have a start date and end date and conditions to check are 1.start date should not be greater than end date 2.end date should ...
1
vote
2answers
24 views

How do you 'require' an attribute on an angularjs directive?

Say I have a directive called 'myDirective'. How can I require that all instances of this directive must have a specific attribute on them such as bellow: <div data-my-directive ...
1
vote
1answer
27 views

Creating an angular directive that binds a service?

Not sure if I am misunderstanding how directives are created here. Say for example I have a controller such as: angular.module('myApp.controllers').controller('MyController', ['$scope', 'MyService', ...
0
votes
2answers
31 views

Event listener to dynamic HTML not working

Using a angularjs directive, I am adding an event listener to a dynamically created HTML element that is inserted into the DOM. However, the event listener is not triggering. If I add an event ...
3
votes
4answers
59 views

How to stop ng-click from a custom directive in AngularJS?

LIVE DEMO Consider the following myButton directive: angular.module("Demo", []).directive("myButton", function() { return { restrict : "E", replace: true, scope: { disabled: "=" ...
0
votes
3answers
48 views

Lay out HTML elements depending on the number of elements

The issue is that I have to lay out from 2-4 html video elements, but the number is dynamic, sometimes can be 2, 3, or 4 elements. With 2 I will lay them out both side by side, 3 elements will be ...
0
votes
0answers
20 views

loading the angularJs directive through partial

I am new to AngularJs and struck with an issue. I have "index.html" where I need to have the main section loaded via the <div data-ng-view=""></div>. Now, the data inside the view will be ...
0
votes
0answers
21 views

Angular emails list input

I need a component much like a ngTagsInput, but for a list of emails, and I need support for copy and paste (with several separated emails, with a configurable separator). What are my alternatives? ...
2
votes
1answer
15 views

angularJs custom directive not working with templateUrl

I am new to AngularJs. I am writing my custom angular directive which contains a template of some html content. When I use the template with the below code it works fine. ...
0
votes
2answers
21 views

angularJs custom directive not invoked

I am new to AngularJs. I have created a simple custom directive in Angular to print out some text. The code is below: var demoApp = angular.module('demo-app', ['ngRoute']); ...
0
votes
2answers
18 views

creating custom angularJs directive to make modular code

I am new to AngularJs. I am having a div section and some jquery code related to the div elements. I am planning to make a partial of this code and create a custom directive. Is this is good design. ...
0
votes
1answer
20 views

Angular scope undefined inside $watch and scope variables not available inside $animate function

I have an animation directive that uses scope.$watch to listen for a change on it's attribute, in this case the directive itself. The problem is I need to manipulate parent scope variables from ...
0
votes
2answers
26 views

Angular 1.2.16, isolated scope, parent function and ng-click

I'm stumped with a rather simple issue with Angular (as I think it is simple). Sometimes Angular make me feel dumb, because it can't be possible I'm doing something terrible wrong. Take this plnkr ...
1
vote
0answers
6 views

Best API for directive that manipulates a collection [migrated]

I'm working on a reusable directive that allows for unrolling the items in the directive via ng-repeat and supports removing and reordering items. The setup might look like the following: ...
0
votes
1answer
29 views

How to handle data binding and dom manipulation for showing/hiding an object in AngularJS

I have a simple overlay directive that is displaying when the user clicks a button. I'd like to make it such that if the user clicks on the overlay it hides itself. However, I have a ng-show that is ...
1
vote
1answer
30 views

AngularJS testing directives with templateUrl

I'm trying to use karma to test AngularJS directives. But I'm running into issues with templateUrls. Using technique described here, it gets even stranger. It seems to work as advertised and loads my ...
0
votes
2answers
34 views

Losing binding on directive

I have this fiddle that shows a directive that has an alert for now. There is also a controller that has alert. This is all working fine except for the fact that the binding is being lost for the text ...
0
votes
1answer
29 views

transcluded content requires the controller of the transcluding directive

I have a directive which is transcluding it's content. And in the transcluded content is a directive which requires the controller of the transcluding directive. This throws an error if i'm creating a ...
0
votes
2answers
26 views

Attribute directive to work on an element inside another directive

I have hit a wall with what I need from angular, hopefully there's an easy way to achieve what I'm after. I have a directive that looks something like that: m.directive("string", function() { ...
1
vote
1answer
26 views

Calling function defined in attributes in AngularJS directive

I'm using a jQuery-ui datapicker and have defined a directive (credit: http://www.abequar.net/posts/jquery-ui-datepicker-with-angularjs) to instantiate it. I'd now like to add an html attribute that ...
0
votes
0answers
38 views

Angular is taking too much time while using ng-repeat

We are using angularjs for our html5 app we have over 300 message and we want to print all the message on single page we are using this code to print all message using data-ng-repeat directive ...
0
votes
1answer
20 views

How to pass down ng* attributes in a custom directive?

I've created a custom "bs-input" directive that wraps an input field into a bootstrap template. It works allright if I fill in all the attributes (type, max-length, required, pattern, etc). However, ...
0
votes
1answer
34 views

Passing id and as a parameter to directive

http://jsfiddle.net/mato75/t48qn/ I have a directive, that if id is not passed, then it should generate one, but it looks like that the generation is to slow and the id is not present in the ...
0
votes
2answers
21 views

creating angularJs directive for jquery code

I am new to AngularJs. I have a jquery code which I am planning to create a AngularJs directive. How to wrap the jquery code inside a AngularJs directive. I just want to use the same jquery code but ...
0
votes
0answers
18 views

AngularJS What is the correct way of cutting up your IHM

I'm now using Angular since a couple of months and i'm wondering if i'm doing it right as far as IHM organisation go. I've my Index page like this <html> <head> <all my script and ...
0
votes
1answer
25 views

javascript not working after pageload

I am new to UI development. I am using AngularJs in my project. I have configured the routes, controllers inside a module and referencing the same inside the html page. The controller is responsible ...
0
votes
0answers
15 views

Load Angular library on specific pages

I am trying to integrate Angular in to parts of my web application. When i say parts, i mean there are a number of pages with either just static text or images which it does not make sense to load a ...