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.
1
vote
3answers
17 views
Angular JS comment directive does not function properly
The following code does not seem to print the text out from the directive defined:
<div ng-app="myApp">
<!-- directive: devComment -->
</div>
<script>
app....
0
votes
1answer
19 views
Angular get promise data before directive link execution
I am working on a directive that needs some information to work. But that information comes from a promise and the directive loads without that information because it takes more time that the ...
0
votes
1answer
21 views
Partials in Angular but not ng-include/directives
There is a piece of code in my angular that is being repeated in two files.
I made it a directive so it could be reusable. I'm sending it some data.
Let's assume this is the template:
<...
1
vote
2answers
25 views
AngularJS - how to set css class for the custom directive?
Have tab css class for the nav html element which I'm going to use as directive like this:
<nav tab></nav>
It expected to be interpreted like this:
<nav class="tab">
<a>...
0
votes
0answers
13 views
How to design an angular directive which can be used multiple times on the page
I'm using Angular 1.x.x
The goal
I am about to create a component which is actually a simple directive (or component) which can be used multiple times on the page. Let's call it the main directive
...
0
votes
2answers
32 views
Get selected value in angular js
I am new to angular.I was making a simple demo for select in which I will add new select according to current value selected. I am usig dynamic value for options and for model as well. I am not able ...
0
votes
0answers
12 views
Angular 2 RC 6 Scroll directive is not working
I need to call some method in element component, when scroll bar of this element is reached bottom.
In RC 3-4 this is works well. But in my newest Angular RC this directive is not working (onScroll()...
30
votes
4answers
40k views
Multiple directives [myPopup, myDraggable] asking for new/isolated scope
I wrote a directive for dialogs (myPopup) and another one for dragging this dialog (myDraggable), but I allways get the error:
Multiple directives [myPopup, myDraggable] asking for new/isolated ...
0
votes
1answer
16 views
Nested directive, where child directive is based on parent attribute
Is it possible to "tell" a directive to use another specific directive, based on the attributes provided to the first directive?
An example:
Let's say i have the following HTML
<parent-directive ...
0
votes
1answer
24 views
Variable exchange between directive and controller in Angular
I know this has been asked loads of times but I can't seem to find an appropriate answer for my case.
At the moment I have a form to "invite more people" that takes a name and email.
Underneath that ...
0
votes
2answers
31 views
how to open dropdown in angular js?
can we open the dropdown when it focus using tab keyword .I want to open the drop down while using tab navigation .
Example if I am in input field (focus to input field ) then if I press tab focus ...
0
votes
3answers
47 views
Angular ng-if multiple conditions not working
This is a relatively simple question but I cannot figure out why this isn't working.
So I have ng-if statement in HTML where I check condition if its not true. as in:
<div class="new-asset" ...
1
vote
0answers
24 views
angularjs re-initialize directive
I have the following code
HTML
<countdown ng-show="vm.inhotel" init-val="vm.finishtime" init-lastmess="''" init-mess="'Sjekk ut'"></countdown>
Controller
vm.finishtime = 0;
vm.inhotel ...
1
vote
4answers
35 views
ng-controller not rendering data to browser
I am new to Angular JS and I am facing some issues in the ng-controller which is not sending values to the browser screen. I am using angular 1.5.8. How can I get this code to display values.Attached ...
0
votes
2answers
40 views
Why directive is not calling my controller method?
Directive is not calling my controller method. Following is my code:
Controller:
exports.controller = ['$scope', function($scope) {
$scope.addParamter = function () {
console....
0
votes
0answers
11 views
angularjs isolated scope local property ''&" not triggering the function being passed
I am facing the problem with one of my custom directives.I am passing a function from view(html) as the isolated scope local property(&) but the function doesn't get triggered/called. I have ...
0
votes
1answer
26 views
how to deploy angularjs app using webpack after uglify on heroku
I need to deploy an angularjs app.
after I used webpack to uglify the production app. The below commands appeared.
The app is working fine when I run webpack-dev-server
Hash: 06f0e2d056b597c4e43f
...
1
vote
2answers
20 views
angular {{ }} expression not resolving inside ng-click
The line below fails, the console shows "index is undefined" when the image is clicked:
<img class="full-image" ng-click="addFavorite({{dish.id}})" ng-src="{{baseURL+dish.image}}" title="{{dish....
0
votes
1answer
35 views
Angular delete after requireJS optimizer
we have written a directive in angular, which uses blueimp-fileupload. As long as we do not use the requireJs optimizer the code works fine. But after we run requireJs optimizer, we get the following ...
0
votes
2answers
27 views
Removing element from DOM via ng-if bound to attribute directive scope property
I assumed this would be straightforward, but it's seemingly not!
I'm trying to create a generic attribute directive that will call a method in one of my services and conditionally cause the element ...
0
votes
0answers
21 views
bindToController doesn't propagate changes inside link function
I have a d3 chart that gets the data from other parts of the page. So I used a directive to encapsulate d3 related code and controller to supply the data to directive. I have setup binding to data ...
0
votes
0answers
24 views
offsetWidth and scrollWidth both returning 0 in my angular directive
I'm pretty new when it comes to Angular directives. I'm trying to make a directive that will display a tooltip with the full text if there is text that is truncated on a page within an ng-repeat. I ...
-1
votes
0answers
4 views
extend base directives to child directive
I have a base directive which returns 3 options (using template URL). I want to extend the directive to return the other three from my template URL (a total of 6). How can I do this without altering ...
0
votes
0answers
9 views
Delay problems updating parent variable in Angular JS with Directive
I am quite losing a bit the mind trying to figure it out the best solution for this.
I have a MainController for a page, which have several values, a directive which create a select dropdown, and a ...
0
votes
0answers
15 views
Multiple models inside directive
I get a problem with my products-totals directive. When I'm changing a model value this one is not updated on the view. If I want it, I must change the model value of scope.$parent (like my comments ...
0
votes
1answer
30 views
compile html string with ng-click inside foreach loop
I have a tree structure that has tons of items, so it is working very slow. I am trying to rewrite it in javascript to obtain a bit more performance. But I am stuck at the ng-click:
HTML:
<...
0
votes
2answers
28 views
Controller data not passed to directive
I started looking into angular and cannot seem to figure out why my data is not passed to my directive. I have code here: https://plnkr.co/edit/ONwYevQ4NbvBVjTwARHl?p=preview
My Code:
app.js:
var ...
0
votes
2answers
26 views
How to pass attribute value to function that is used in a directive template?
I want to build a reusable autocomplete textfield component. At the moment I can't make it reusable, there can be only 1 instance.
This is the template:
<md-content class="md-padding">
<...
0
votes
0answers
23 views
iOS keypad not getting hidden after upgrade to iOS 10 in angular js
I have recently updated device to iOS 10 and facing issues with hiding iOS keypad when i switch from one view to another.It was working well with iOS 9.3.
Programmatically what i have done is, i was ...
3
votes
1answer
352 views
Change HTML input field to label by defining custom angular directive
I have lots of input, textarea and select on some pages (angular templates).
I want to redefine "input" directive such that It will take a value like ViewMode = true from either localStorage and ...
107
votes
6answers
46k 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.
0
votes
2answers
46 views
AngularJS: Prepend HTML using Directive
Service.js
this.showSpinner = function (Id) {
angular.element("<wave-spinner id='spinner00' ng-show='true'></wave-spinner>").remove();
var myEl = angular.element(document....
0
votes
1answer
31 views
AngularJS ([$parse:syntax] Syntax Error: Token ':' is an unexpected token at) when value is URL
I have created a directive as below:
angular.module('mymodule')
.directive('httpsimg', function () {
return {
restrict: 'E', //E = element, A = attribute, C = class, M = comment
...
1
vote
0answers
15 views
updating controller scope from directive
I have a problem updating a scope variable from a directive. my code looks something like this (simplified):
CONTROLLER
function newProjectController($scope) {
$scope.imageUploaded=false;
}
...
0
votes
0answers
9 views
$setViewValue not working since Angular update 1.4.9
I created a directive that clears my ngModel value when the element is destroyed (removed from DOM).
I used "ngModel.$setViewValue(undefined)" to clear the model value.
This worked in Angular ...
0
votes
0answers
17 views
Window Infinite Scroll in Angular
I had implemented infinite scroll directive its working fine on scroll.
Problem :- Its getting trigger once the state change that means infinite scroll method is trigger one more time when page gets ...
0
votes
0answers
7 views
Md-Tabs or Md-Nav-Tabs within Md-menu Event Keeps Propagating
I'm trying to have md-tabs or md-nav-tabs within a md-menu. Yes I know it is not good practice, but it does what I need, perfectly, if only it would stay open as the tabs are clicked.
So I found ...
0
votes
1answer
11 views
Spy for $rootScope.$broadcast is not working when everything else is?
I have a keyboard shortcut directive that I'm trying to test. It's purpose is to trigger $rootScope.$broadcast() with the event data. In the application it works without any issue but I can't get this ...
0
votes
0answers
20 views
Angular Drag and drop from A to B issues with NestedList?
I am trying to create drag and drop element, and I came upon this nested list on: http://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/nested
This is my model
$scope.models = {
...
3
votes
3answers
25 views
AngularJS ng-if not deleting element after $compile
I have a directive that does the following:
Adds another directive attribute to the element.
Removes its own attribute.
Calls $compile() on the element to make AngularJS re-compile the element so ...
19
votes
10answers
22k views
Multiple directives asking for templates on
I have the following HTML:
<div style="border:1px solid; height:300px; width:500px; position:relative; left:100px" id="canvas">
<tbox ng-repeat="tb in textBoxes" ng-model="tb">
</...
-4
votes
0answers
56 views
AngularJS page shows variables instead of contents
I am totally new to AngularJS and when I bought an AngularJS web app script online, the pages look fine on browser with proper HTML, but when I do a "view source", below code is what I saw (a 404 Page ...
0
votes
1answer
57 views
AngularJS $compile and external directive ui-codemirror
I am trying to use the external module, angular-ui-codemirror, to display the $element.html() of an enclosing AngularJS directive in a code-formatted block, using nested directive ui-codemirror.
If ...
0
votes
0answers
8 views
Parse directive from text returned from ajax - angularjs
I have a directive in angularjs, and success to use it like below:
<div my-directive my-data="{}"></div>
can show <div>Hello</div>
When I load it from an ajax call. For ...
0
votes
0answers
22 views
Angular Directive document.querySelectorAll() testing
I have the following scenario.
In my parent directive template, i pass the type of directive to be generated inside.
<par slider-type="config">
<!-- child directive -->
</par>
...
0
votes
2answers
1k views
How to highlight unique cell in UI Grid using cellClass function?
My requirement is that I am suppose to be highlighting specific cell by its row number and column number. But in given plunked when I scroll the grid other cell also getting highlighted. Looks like I ...
0
votes
0answers
23 views
Why won't my Angular form react to validating changes?
I have the following form. I added the reaction to submit action ng-submit="signupForm()" and handle like the following:
controller('signupController', function ($scope) {
$scope.signupForm = ...
0
votes
3answers
31 views
My program is running but null value is coming at the end.how to remove this error in my program.Why it is coming?
<!DOCTYPE html>
<html lang="en-US">
<script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"/> <head> <meta charset="ISO-8859-1">
<...
34
votes
5answers
78k views
How to validate email id in angularJs using ng-pattern
Am trying to validate an Email id field in angularJs using ng-pattern directive.
But am new to AngularJs. I need to show an error message as soon as the user enters the wrong email id.
The code ...
1
vote
2answers
30 views
Conditionally loading the template in a angular directive
I am trying to load the template of directive only conditionally, for example-
.directive('truncate',["$window", function($window, $compile){
return {
restrict: 'A',
templateUrl: '...