Questions tagged [angularjs-directive]

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.

Directives are a way to teach HTML new tricks. During DOM compilation directives are matched against the HTML and executed. This allows directives to register behavior, or transform the DOM.

A directive is a behavior or DOM transformation which is triggered by the presence of a custom attribute, element name, or a class name. A directive allows you to extend the HTML vocabulary in a declarative fashion.

Angular comes with a built in set of directives which are useful for building web applications but can be extended such that HTML can be turned into a declarative domain specific language (DSL).

One can create his/her own custom directives in order to have own manipulations according to one's requirement.

Useful links

17531 questions
4
votes
1 answer

Extract a binary file content in byte array using angularjs

I would like to extract binary data from a binary file into a byte array. I am having difficulty getting it to work correctly. You can see the jsFiddle here: https://jsfiddle.net/alexsuch/6aG4x/ The HTML:
4
votes
3 answers

Change controller scope value from directive AngularJS

I have a condition in which I have input boxes in listing grid and I have a single directive, now I want to send the value to this directive what ever the input value is..up to this point its working fine, but now when I am trying to change the…
4
votes
1 answer

angular directive automatically re-instantiated when scope change

Many of my directive (soon to become components) takes their scope from variables set by other directives. Currently in each directive I have to watch my scope to know if it has changed which seems to complicate the code unnecessarily. So I started…
Pascal DeMilly
  • 681
  • 1
  • 6
  • 16
4
votes
2 answers

Dynamically Change Page In Angular2

In AngularJS 1 we simply add ng-app at top of the HTML tag and bind services to change metadata on the fly. But in Angular2 the quickstart app in official site made index.html completely static (css, meta, ...), only left app tag to bind with…
Vincent
  • 1,178
  • 1
  • 12
  • 25
4
votes
3 answers

Highcharts spans beyond bootstrap column width when implemented as an angular directive

I have implemented an angular directive for highcharts as follows according to this highcharts blog post: angular.module('highCharts') .directive('ngChart', function () { return { restrict: 'E', template:…
Deepal
  • 1,729
  • 5
  • 24
  • 34
4
votes
3 answers

How to extend an Angular factory

I have a data services file that I want to break up into smaller modules/pieces. Currently, the code is something like the following: angular .module('myapp') .factory('DataService', DataService) DataService.$inject = ['$http']; function…
4
votes
1 answer

Pass JSON Object to angular directive

I am trying to pass json object to angular directive but can't find any solution yet. here is the code. Directive function agEcalendar() { var directive = { restrict: 'E', templateUrl: 'app/components/ecalendar/ecalendar.html', …
Ahmad Abbasi
  • 1,776
  • 6
  • 29
  • 43
4
votes
3 answers

IntroJS Add Directive To Step Markup

I am using introJS to have a user guide. I can show various features, however, i want to add a directive to the markup e.g: $scope.IntroOptions = { steps: [ { element: "#step1", intro: "Click the button:
Oam Psy
  • 8,555
  • 32
  • 93
  • 157
4
votes
3 answers

Isolated scope value is not changing on click

I have a simple example where I want to show the word "Peter" by directive templating. When a person makes a click on div - the name changes to "Juliet". However I am finding no error and nothing visible on screen.
Deadpool
  • 7,811
  • 9
  • 44
  • 88
4
votes
1 answer

ngClick events not firing in Angular 1.5.5 component

Why doesn't clicking the button described in the template below work as expected? This blog post does the exact same thing. 'use strict'; angular.module('core').component('foo', { bindings: { items: '<', }, controller:…
Sean Lindo
  • 1,387
  • 16
  • 33
4
votes
1 answer

Directive on ready function should only execute once

Hi Experts I have a directive 'my-table' in which there is a button for edit record. Inside directive template (html file) I have a button Edit Inside JS file …
4
votes
4 answers

Angular directive didn't update model view

I'm trying to show comments in template after clicking button in form using directive HTML:

Comments

4
votes
3 answers

What is the role of ng-app directive?

I am new to angularJS. Now I am trying to write a simple angular application. But I am wondering the role of the ng-app directive. And is it possible to add ng-app in a div tag instead of html tag? If possible, is there any…
user6223644
4
votes
3 answers

A simple directive to show name of user not working

I have made a simple example of custom directive to show name of a person. It still is not showing it. Can someone help?
Deadpool
  • 7,811
  • 9
  • 44
  • 88
4
votes
2 answers

Object passed to Angularjs directive is undefined

I've been following the docs and reading other questions on SO, but I'm completely baffled. I have an AngularJS 1.3.14 app. I am using ng-route with controller-as syntax to get to my page. I have a large page that is working great. However, I'm…
Ken DeLong
  • 341
  • 2
  • 5
  • 16
1 2 3
99
100