AngularJS directives are a way to teach HTML new tricks by extending the HTML vocabulary. Directives allow you to manage DOM elements in a declarative pattern, freeing you from low level DOM manipulation tasks.
0
votes
1answer
16 views
AngularJS directive for calendar
I'm migrating an existing site to AngularJS and I'm having trouble with Boostraps's datepicker.
HTML:
<div id="calendar" class="pull-right"></div>
JS:
$('#calendar').on('changeDate', ...
3
votes
2answers
42 views
How to assign 'ng-style' directive value based on 'ng-repeat' count
I have an Angularjs sample snippet. here using ng-repeat directive to display names in a table, I am planning to add ng-style directive to add vertical scroll bar to a table based on table row count. ...
0
votes
1answer
16 views
angular js dependency module config works one time
I have a module composition like this:
angular.module('mainModule',["cityModule", "countryModule"]);
angular.module('mapModule',[]);
angular.module('cityModule',["mapModule"]);
angular.module('...
0
votes
0answers
25 views
AngularJS directive input fields are read only
So I am trying to write an AngularJS (version 1.4.8) directive which outputs the value of an attribute in an input box. The directive looks like this:
(function () {
angular.module("myApp")....
-2
votes
0answers
13 views
Is the id attribute redundant when using 'name' with AngularJS2
I'm learning Angular 2 from this tutorial.
It features the following code. I'm curious as to the use of 'id="XX" ' when we have 'name="XX"' used in the Angular directive. It doesn't seem to make a ...
0
votes
0answers
11 views
How to get directive's ng-model value from directive to view or controller?
JS file (some part):
$scope.selectedData = null;
$http.get("http://localhost:7643/api/MemberApi/GetMembers/")
.success(function(data) {
$scope.datas = data;
$scope.onSelect = function(...
0
votes
0answers
32 views
Reading directive attribute value in controller
If I have a directive which is used twice like this in a specific view :
<token-dialog token-target="compose.mailing.title"></token-dialog>
.
<token-dialog token-target="compose....
0
votes
1answer
19 views
Angularjs 1.5 replace directive element html
I want to built an ng-repeat with dynamic buttons that change according to $state.params so I wrapped them in a directive.
link:function(scope,element,attrs) {
$rootScope.$watch('params.source',...
0
votes
1answer
21 views
Rendering part of component outside of the component itself
I have JSFiddle like this:
https://jsfiddle.net/ownvjjow/
Basically the problem is that I'd like to render some part of component x outside of the element(x) itself. Like in the outer scope, but ...
0
votes
0answers
15 views
Scroll to various location on an Angular page using href and $anchorScroll without reloading the page
I am trying to create menu links that will allow the user to scroll to various locations on a single page without reloading the page. I have been able to get this to work using some of the questions ...
0
votes
0answers
14 views
Angular: Implement 'Save Changes' on leaving state (Screen)
Can someone guide me is there anyway to prompt for confirmation like 'Do you want to save you data?' whenever user has added something in form (Say form is touched) and he is trying to leave that ...
0
votes
1answer
16 views
Add DOM element when transcluding except for the last one child
I would like to add a <hr> element between each clone of my transclude function except for the last one clone.
The parent directive have a custom HTML template.
In this template, I call a ...
2
votes
4answers
67 views
Directive with ng-model Attribute Not Resolving Using $http
Trying to make a rating directive but I'm stuck at getting rating2 to work. The first rating worked because the rating1 is hardcoded within the controller. But normally I have to get the saved rating ...
1
vote
0answers
33 views
Is it better to use directive with or without isolated scope for a custom input field validation directive? [on hold]
I have a directive for checking form validation.
Requirements are
Check if ngModel value is empty.
Call a function only if all values are filled.
Also set a variable true or false based on the ...
0
votes
4answers
36 views
Why do we need directives in angularJS?
I am a newbie in angularJS so those who read this, may feel this as a silly question.
But the answers for the question that google returns is not actually answering my question.
The below link ...
0
votes
1answer
19 views
Angularjs Action Tooltip service
I would like to ask you if anyone knows how to make this kind of action tooltip in angularjs ?
0
votes
1answer
24 views
Angular $compile cant find directive
I have a current project based around single-page-applications (SPA) and wanted to implent a function that dynamically loads directives into my html based on which kind of SPA is required.
The ...
2
votes
0answers
33 views
Invalid input is removed from input after compiling in Angular directive
I have a directive that adds custom and native validations to inputs according to a list of validations in a model. Values of the validations can change according to input elsewhere in the form (e.g. ...
0
votes
1answer
25 views
Pass params to function inside AngularJS template
I would like to know, how to pass params to function dynamically inside AngularJS template.
I have many rows in table and each row has a button Add deposit. I would like to pass row number to this ...
0
votes
0answers
32 views
Angular - Setting form element to invalid from directive not invalidating form
I have a directive that handles password requirements. The password needs to be validated on keyup so that each regex can be evaluated and updated in a popover as the user inputs characters. When I ...
0
votes
0answers
17 views
Removing attributes from angular custom directive
I have a custom directive with isolate scope and = bindings that just wraps a control specified in a template and maps attribute values onto it. In order to avoid blank attributes on the wrapped ...
0
votes
1answer
162 views
AngularJS || Ignore ngBlur on element blur when executing other function that does blur
While developing I have encountered an issue of firing blur two times, when i need to fire it only once.
Both ng-blur and ng-enter final actions are to make request to database, in our case 2 ...
0
votes
1answer
19 views
How to get updated value for isolated scope using angular directive?
i have a directive that is making xml pretty for browser when first time page loads it gets the string value. but when value change dynamically string is not being updated xml remain same. Any idea ...
0
votes
1answer
30 views
Using Angular, when should I use ng-model as opposed to binding to a property?
I am building a directive that I will be using in several places in my application. It is a combination of a multi-select field and type-ahead. To pass data back and forth to the multi-select portion, ...
0
votes
1answer
26 views
Implementing Keyboard interaction on modal pop up [Angular JS]
I have created a custom component in angular js for a modal pop up. Everything works fine. Now I would like to implement keyboard interaction on this. That is when the Modal pop up shows the message, ...
0
votes
1answer
23 views
route to specified number of views in angularjs
I am in the process of building a mobile web app with AngularJS. The app will allow the user to record the salary and other figures for employees.
On the first page the user will select the number of ...
0
votes
2answers
23 views
AngularJs : The code i have written doesn't work and Code in comment works. where am I going wrong. Please Explain
I'm learning AngularJS from W3SCHOOLS, and I am facing this problem over and over again!
In the following code uncommentated lines of controller code are written by me and
multiple comment lines ...
1
vote
1answer
25 views
UMD pattern for angular directive
I'm looking to open source an angular directive on npm and I'm trying to come up with the most universal pattern for doing so. How's this? I have 3 questions:
!function(name, make) {
make = make()
...
1
vote
1answer
17 views
How siblings are sharing their scope under following directive structure
I have following directive structure.
<test-widget-body>
<test-task-list-filter>
</test-task-list-filter>
<test-task-list>
<test-...
0
votes
0answers
5 views
testing external directive script is failing the tests
describe('third directive', function(){
var compile, scope, directiveElem;
beforeEach(function () {
/* Directive inside the beforEach is working as expected and button is clicked and test ...
1
vote
2answers
56 views
AngularJs - Custom Directive - Bind modal from the controller
I'm new to angularjs and directives, and I'm actually having troubles with them.
I want to create a custom directive to display images in my ionic 1 application.
To achieve this, I need to bind an ...
0
votes
1answer
24 views
Scope name is {{currency}}, how to get specific value in view
The scope name is :
{{currency}}
I coded this in view. the output is:
[{"code":"USD","value":"0.00670000"}]
I want to get only value USD in front end.
1
vote
3answers
37 views
Unable to load directive dynamically in AngularJS 1.x
I have lots of condition on which I have to change my view dynamically so I need some way in which I just change in my object and view will react to it.
I am trying to load directive dynamically ...
0
votes
0answers
14 views
how to wrap a jquery Plugin - jtable.js in a angular directive?
I am trying to wrap jtable in a angularjs directive. But i am not able to run it. its working fine in jquery, Can anybody help me with this?
My html code is:
<jtable></jtable>
My ...
0
votes
1answer
26 views
How to load attribute directive dynamically in angular 1.x
I am trying to load directive dynamically using values in an object. To do that I have tried following :
<body ng-app="myApp" ng-controller="myCtrl">
<div {{testDirectiveJson.first}}-...
1
vote
2answers
40 views
In Angular 1.x how can I access controller methods from a custom directive?
I am currently trying to figure out the best way to access two controller methods from within my custom directive. My current code looks like so:
Parent Component Template (navMenus.html):
<menu-...
2
votes
3answers
75 views
Scope values aren't displayed when getting HTML from server
UPDATE
After doing many tests on my code I'm updating my previous question, as it's now clearer to me what's not working.
My HTML file is served when I browse to the / directory in my local
All the ...
1
vote
2answers
40 views
$watch is not working with directive value
So I'm creating directive that will match passwords. I was trying to figure out my own way to do it. And when, finally, I though I had found solution it didn't work. Here is the dricetive code:
...
-2
votes
1answer
36 views
how to upload image when its show 500 error in angularjs
i want upload image but its show below error how to solve this problem, because other format of html working fine ..i want use in angularjs
500 (Internal Server Error)
<input type="file" name="...
0
votes
1answer
34 views
AngularJS - Directive to Directive function call
Directive One
myApp.directive("myDirective", function ($compile, $rootScope) {
var linker = function (scope, element, attrs)
{
var myEl3 = angular.element(document.querySelector("#...
0
votes
0answers
35 views
Custom 'compile' directive renders ng-repeat multiply times
I am using a custom "compile" directive to render HTML snippets that I push into a div container which is working great. One problem I am having is that it seems like the compile directive gets called ...
0
votes
3answers
24 views
how to call twice nested method in angular 1.x?
My HTML looks like this:
Controller HTML:
<div ng-controller="Ctrl">
<first-directive></first-directive>
</div>
first-directive HTML
<li>
<second-directive>&...
1
vote
3answers
49 views
Why the expression is appearing as it is in AngularJS example?
I've following code :
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<p>Try to ...
0
votes
0answers
23 views
Angular Advanced Searchbox - Multiple Choice select
I am trying to get this directive to work with multiple select per parameter.
For example i want to add to the parameter suggestion a extra attribute (groupValues), which could be like this:
{
...
0
votes
1answer
28 views
How to execute Angular ng-click directive inside custom component on enter key press
I have a custom icon component using isolate scope where a user can define what he or she wants to happen on ng-click:
<ers-icon name="history" ng-click="ctrl.clickAlert('history')"></ers-...
0
votes
2answers
27 views
Can I use a Directive in the template function?
So this is a simple example i just wrote up for the sake of this question, I'm curious if I'm able to use a directive and pass in an object to the directive's attribute, all in the template, not ...
0
votes
2answers
24 views
How to delay the google autoComplete function to save credit
As you know every time when we type the google map autoComplete will fire, I want to set a delay function for this, such as 250ms,so give user more time to type and also save the credits. I try to add ...
2
votes
4answers
48 views
Remove DOM-Element with AngularJS
I'm trying to remove a navbar based on the current location path.
This is what I have so far:
angular.module('myModule')
.controller('MainController', function ($location, $document) {
if ($...
0
votes
1answer
35 views
how can I pass 'scope' argument outside the directive
how can I pass 'scope' argument outside the directive?
i need use it in some other component..
my code:
(function () {
angular.module('dmv.shared.components').
directive('doImportPackage', ['...
0
votes
0answers
31 views
How to append the same template twice within another template - Angular 1.5
I am an Angular newbie. Using Angular 1.5, I have a main template with a button.
ui-sref on the button is linked with a ui-router that loads an image (another template). My requirement is to keep ...