In 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
0answers
15 views
bound value not updating in view
the directive
angular.module('myapp')
.directive('hcComponentBlocker', function () {
return {
templateUrl: 'views/hccomponentblocker.html',
priority: 1005,
...
5
votes
4answers
6k views
angularjs ui-date to show month year only
I am using ui-date directive (https://github.com/angular-ui/ui-date).
This UI Calendar component is getting Date by default. Can I get only month and year without dates.
How to get only month and ...
0
votes
1answer
19 views
Angular expression doesn't work with ng-disabled
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular.js"></script>
<body ng-app="myApp">
<div ng-controller="toDoCtrl">
<div>
<hr>
...
0
votes
0answers
5 views
Getting an .ejs file to run functionality through custom AngularJS directive?
I am working on a website that renders .ejs pages, and depending on certain conditions in the code, certain HTML elements will show. I will spare the details but here is the issue:
I created a custom ...
0
votes
1answer
25 views
Get an element in DOM hierarchy from the link function of a directive [AngularJS]
I have a simple DOM hierarchy and I want to grab a specific set of elements (I want all the canvas elements). This is the entire template for this directive:
<div id='charts-container'>
<...
0
votes
0answers
5 views
How should I create a custom ng-click directive that can make a tracking call to segment.io
I want to be able to create a custom click directive for tracking ng-click events.
I'm assuming I would need a custom click directive like track-click="handleClickEvent()">
I would want to wrap ...
0
votes
0answers
12 views
pass in content of css into directive
Is there a way to use the content of css for a directive. I want to reuse a directive and then in that directive, set the class so that way the content can be different icons from FontAwesome?
...
0
votes
0answers
29 views
Angular Directive to format currency
I need a directive for filtering a field for currency, so a user just needs to type and the decimal is implied.
Needs:
Format decimal field as user types
Field must be a number
Must allow negatives ...
29
votes
6answers
63k views
Closing Twitter Bootstrap Modal From Angular Controller
I have a modal window that I use to present a form to users. They enter the information and then press a button the has an ng-click. The server processes the request and sends back a response. When ...
0
votes
1answer
24 views
How to call $setValidity in directive only if required attribute exists
I have a directive where I call this:
ngModel.$setValidity('required', isFinite(scope.inputValue) && scope.inputValue != null);
to set whether the value has been filled by the user or not. ...
1
vote
2answers
47 views
Perform Group By and Sum by property in angularjs
Ok so have a simple page that displays a collection of objects in using ng-repeat="(key, value) in data| groupBy: 'Id'"I would like to group the data by a known property and also perform aggregate sum ...
1
vote
2answers
25 views
Update class of parent element by change on ngModel
I am trying to do like..,
If ng-model is not equal to blank then update the class of which is just written above of this ng-model.
I have overridden the ngModel directive by this. I am also able ...
1
vote
1answer
16 views
Dynamically load Angular UI-Bootstrap accordian from controller
I'm using an array in my controller to store a list of names. Depending on the company the user clicks on, however, that list will obviously change many times after the page is loaded.
I have a ...
0
votes
1answer
21 views
Changing a model from a directive callback function in AngularJS has no effect
So, what I want is a custom directive which will read and clear the current selection, and then pass the selected text to a callback function. This works, but whatever I do in that callback function ...
8
votes
2answers
25k views
console.log Angular directive scope outputs “[object Object] No Properties”
Looking at the videos over at http://egghead.io, I see the author uses console.log to log out the contents of a $scope or scope object. The output in Chrome is a drillable object. However when I do ...
-4
votes
1answer
43 views
Way to make backspace delete whole words at a time
I have a text area:
<textarea type="input" id="txtText">Hello+world-how*are+you</textarea>
I want a way for backspace to delete a whole word every time it is clicked using Javascript ...
0
votes
0answers
14 views
Pass variable into directives on canvas
i want to draw an image in e canvas. I try to make a directive; under my code.. I have two canvas on my application. When i invoke this directive the image parameter is undefined. Plaase can anybody ...
2
votes
2answers
41 views
Custom directive calling issue
I have written a custom directive to format a value, which is given below
var directiveapps = angular.module('myApp.currencyValues', []);
directiveapps.directive('currencyValue', function () {
return{...
0
votes
0answers
22 views
Create a directive for file input using AngularJs
I wrote the following directive for watch input type="file":
app.directive("fileRead", [function () {
return {
link: function (scope, element, attributes) {
element.bind("...
0
votes
0answers
37 views
Use Side-bar Nav in component
This is my code
<md-sidenav-layout>
<left-nav></left-nav>
<md-content >
This is content
</md-content>
</md-sidenav-layout>
And left-nav ...
0
votes
1answer
12 views
Drag and drop Angular 1.x directive/component and parent scope
Let's say my grandparent component/directive's scope variable is declared like this: $scope.g = { // methods here };
In each of my nested component's/directive's controllers, I'm referring to that ...
0
votes
1answer
12 views
Call controller function from directive
I'm new to AngularJS.
I want to build an app which could display book information and user could click an icon to remove the book information. I use a customer directive which display each book ...
1
vote
0answers
11 views
AngularJS - JQuery News Ticker - After moving news the javascript function doesn't get called
This is an awkward problem, which will be better explained by looking at the live demo. Basically I have a news box populated with ng-repeat using Angular. Then I am using a jquery plugin called news ...
0
votes
1answer
28 views
how to split a input model string value and store the values as seperate properties in model object
I have a form with multiple currency value inputfields and I have a directive which restricts the currency value to be entered as something like space for example USD 100.But I need to split the model ...
0
votes
2answers
13 views
ng-repeat in angular js directive produces 404 in browser console
i have a very simple angular js directive that loops over a collection using ng-repeat and simply generates an ordered list containing images. The directive works but I have noticed an extra console ...
0
votes
0answers
16 views
Accessing $scope Or Emulating Events Of (Grand!)Parent in Angular
Below I present an Angular template from my project. In it, several activities are listed either by themselves or including their children (if there are any) in an expand-collapse area within the ...
0
votes
1answer
16 views
AngularJS temlateUrl broken in component after Refactor ->Move in WebStorm
I am using WebStorm to do component-based AngularJS development.
As we are having multiple modules used to assemble multiple application variants it happens quite often that I am moving an angular ...
0
votes
0answers
23 views
Updating data of one element updates all data of array
I have a list of tasks and corresponding to each task there is a button, on clicking the button a custom dropdown appears which is a custom directive. In the drop down I have an autosuggest textbox ...
0
votes
0answers
35 views
angular:- How to push an image inside a dynamic div
I am trying to create a kind of CMS application similar to wordpress in which I am giving the user an option to choose the template of his choice and then he can import the images accordingly..
I have ...
24
votes
7answers
7k views
angular ng-href and svg xlink
I'd like some input on using xml namespaced attributes with angular.
The problem is angular comes with a couple of directives to handle writing attributes such as href and src when angular has parsed ...
8
votes
6answers
12k views
How to auto size column width in AngularJS ui-grid
In AngularJS ui-grid , how can I configure the grid so that it can auto adjust the width of the columns according to the contents when it render?
I know there is a tutorial showing the auto size ...
7
votes
9answers
16k views
How can you limit the value from input using AngularJS?
I am looking for ways to limit the value inside the input to 4 and process the 4 digit value unto my controller.
<input type="number" class="form-control input-lg"
ng-model="search.main" ...
103
votes
6answers
42k views
What is the difference between ng-app and data-ng-app?
I have begun to learn about Angular.JS and am confused about what the difference are between the ng-app and data-ng-app directives.
51
votes
3answers
35k views
Stating directive templateUrl relative to root
I am currently stating templateUrl relative to the current window location.
cvApp.directive('personalDetails', function () {
return {
restrict: 'A',
templateUrl: '../../Scripts/...
1
vote
2answers
20 views
Create directive in typescript to show loading progress in angular
I am trying to create directive in Typescript which will keep watch on pending $resource requests. I want only one directive as an attribute which will be used with div in index.html to show loading ...
0
votes
2answers
50 views
how to get data from JSON url using angularJS
**This is my service.js file. this code not working what is the wrong. And how to create service file. This links will execute category list with product. The scenario is when click on the category I ...
1
vote
3answers
148 views
'require' in a subdirective depending on parent directive in AngularJS
I am trying to construct a sub directive which will later be used in multiple directives.
These parent directives have the same controller that provides some methods with which I want to update ...
1
vote
0answers
25 views
What is the difference between scope and model within a directive definition in AngularJS
I was wondering about the difference between scope and model within a directive.
The following 2 directives behave exactly the same:
angular.module( 'exampleApp', [] )
.directive( 'exampleDirective1'...
0
votes
0answers
13 views
ng-change only fires on control losing focus
I have a a dropdownlist(LegalEntOther) I am trying to either show or hide based upon the selection of a first dropdownlist(LegalEnt) . So i have wired up LegalEnt with ng-change directive. If the ...
4
votes
3answers
69 views
can't use 2 js functions with sleep between them
I am trying to create an angular form where the user types text and while he does it the text lable below say "user is typing...".
Then it waits for 200 mili seconds and the text lable goes blank (...
1
vote
2answers
27 views
Using angular-js 'ng-repeat' directive in nav-tabs with each tab having same html but different name and id
This is a small list of nav tabs in my code, actually the list is long. So using ng-repeat would be helpful. Only problem I'm facing is that although the html for all list items is same, the name of ...
11
votes
3answers
283 views
Money formatting directive in Angular
I need a directive for filtering a field for currency, so a user just needs to type and the decimal is implied.
Needs:
Format decimal field as user types
Field must be a number
Must allow negatives ...
0
votes
0answers
15 views
Append angular Directives : $compile not enough when using DOM elements yet to be created
My problem is the following:
Using directive to simplify the HTML code works. Using link, you can even use directives that work on themselves and are able to work on the newly generated DOM elements!...
0
votes
1answer
26 views
Angular JS directive blur event not working with link menu?
I created link menu directive in angular js which will display menu items on enter key press and on mouse hover but I want functionality to hide this menu on blur event when menu looses the focus.
I ...
1
vote
2answers
36 views
Calling callback function in directive doesn't work
I want the directive to pass a value to the callback function (that was defined in the controller). The function is never called, though, and I have no clue why.
HTML:
<input type='file' fileread ...
0
votes
3answers
232 views
How to wait for a child directive render?
I have a directive which uses another directive:
<div style="border:2px solid black;height:150px;padding:10px">
<my-internal-directive></my-internal-directive>
<my-...
0
votes
1answer
24 views
Access a directives scope variable from another directive
I have a directive with a function and I access that function at the click of a button. What I want to do is to access a $scope variable from that function into another directive and use it in that ...
0
votes
0answers
12 views
How to bind variable when calling directive using element.addClass
I am calling directive adding a class to element and compiling element
eg
var el = angular.element(document.querySelector(".ctrl-outer-container"));
el.addClass('directive-name);
$compile(el)(scope);
...
0
votes
0answers
20 views
Angular resolve promise and update existing scope
I am trying to understand Angular's promises and scopes. Actually I implemented the directive bellow. The thing that I want to do is to receive images from server and store locally in order to cache ...
3
votes
3answers
2k views
AngularJs 1.5 - Component does not support Watchers, what is the work around?
I've been upgrading my custom directives to the new component method.I've read that component's does not support watchers. Is this correct? If so how do you detect changes on an object. For a basic ...