0
votes
1answer
18 views
Unit-test a angular controller function in a directive
I have a controller defined in a directive and having trouble unit testing it. Is this possible without globalizing or separating the controller from the directive?? Can you add a simple example??
0
votes
3answers
16 views
AngularJS: attrs.$observe not firing after the first time
jsFiddle here
In the fiddle, if you click on the submit button for the first time, notice that the <input> correctly gets focused on. On subsequent clicks, the focus isn't set any longer.
I ...
0
votes
0answers
17 views
Angular Js Parent Form not able to evaluate dynamically generated nested forms
I have created a parent form, and within it created dynamically generated nested forms using a directive.
The parentForm.$error object is able to evaluate errors that are immediately within the form ...
0
votes
0answers
49 views
angularJS directive, and exposing scope from inside?
OK I am defining a ng-click that retrives data from the currently clicked elements scope, In my directive like so:
scope.dbclickalert = function () {
var getCheckInDate = ...
0
votes
1answer
28 views
angular js dom manipulation with directives
I am trying to use angular directives to dynamically replace an html portion of a portlet of a page.
The html portlet has 2 sections embedded. The top part has the heading which is obtained from a ...
0
votes
3answers
51 views
Transclude in Angular directive putting elements inside a single 'span'
Here is my directive:
myapp.directive('envtable', function () {
return {
restrict: 'E',
replace: true,
transclude: true,
template: '<table class="table" ...
0
votes
2answers
21 views
AngularJS directive syntax
and sorry for this noob question :)
With AngularJS, I want to display a progressbar using UI Bootstrap.
The directive is working well if the value is hardcoded:
<progress ...
1
vote
2answers
34 views
How to bind data in title element using angular.js
I'm learning Angular.js and I set <title>{{title}}</title> and I try to change that using select element
<select ng-model="user.title">
<option ...
2
votes
0answers
35 views
Angular Dialog directives with Bootstrap 3
We're trying to migrate from Bootstrap 2.3.2 to Bootstrap 3 (RC1) and are having problems with the AngularJS Dialog directive. On clicking the relevant button no dialogue popup appears (the page ...
0
votes
1answer
27 views
How do directives control each other?
I have two directives:
module.directive('modal', function () {
return {
restrict: 'A',
templateUrl: "/templates/ui/components/modal.htm",
replace: true,
link: ...
0
votes
0answers
16 views
Use all google maps API features in AngularJS
I am working on a project relying on AngularJS where I need to locate all airports in the world and link them with lines.
To do so, I searched for some existing projects that set angular directives ...
0
votes
0answers
40 views
AngularJS template does not recognize 'options' attribute
EDIT! changing the scope of options to '=' properly sets options in my template. However this introduces the error displayed in the screenshot below
I have a map of options set the following way :
...
0
votes
1answer
19 views
Hierarchical Angularjs directives not retrieving scope variables
I'm building an AngularJS application. I use three directives to build the menu. The titles are inside a i18n file, so most of the attributes are angularjs expressions. Here is a snippet of how the ...
0
votes
2answers
28 views
Angular JSCustom directive validation not working for dynamically generated inputs
I'm using nested ng-forms to validate dynamically generated inputs in angular js, which is only partially working.
I've created a custom validation directive called 'wrinteger' which takes two ...
1
vote
3answers
37 views
Angular directive name: only lower case letters allowed?
My code:
app.directive('abcabc', function (){ alert('directive');}); // working
but
app.directive('abcAbc', function (){ alert('directive');}); // not working !
app.directive('abc-abc', function ...
1
vote
0answers
33 views
Angular extending ui.bootstrap.progressbar to support some text on the progressbar
I'm using ui.bootstrap.progressbar (code here: https://github.com/angular-ui/bootstrap/blob/master/src/progressbar/progressbar.js) and I'm trying to extend it to support some custom HTML (or just ...
1
vote
1answer
77 views
Angular.JS: click-to-edit directive form updates model, but http.post still uses “old” values
I'm having a strange problem creating a click-to-edit directive with angular.js:
The model gets updated on form submit, but the updated model is not used in an following http.post, the old one is ...
2
votes
3answers
76 views
Disabling ngClick event handling in a custom directive
Here is a directive in which I'm attempting to disable a link based on a model value:
app.directive('disableable', function($parse){
return {
restrict: 'C',
require: '?ngClick',
...
1
vote
2answers
70 views
AngularJS: Linking to elements in a directive that uses ng-repeat
I have a simple directive where the template uses ng-repeat inside it. I need to run some code to instantiate a jquery component against some of the elements created by the ng-repeat directive. The ...
1
vote
1answer
65 views
AngularJS http request is never executed
I have a minimal plunk of this here.
Here's what's happening:
initial $http request is made successfully
a click event is bound to a button in a directive
clicking the button fires the desired ...
2
votes
1answer
129 views
AngularJS/UI ui-sortable does not have isolated scope?
While I was looking into an issue I was having with ng-repeats in the ui-sortable directive, which I later found was the same issue as this (https://github.com/angular-ui/ui-sortable/issues/2), I came ...
-1
votes
1answer
545 views
Breadcrumbs in Angular
I want to use Angular's breadcrumb capability. I added this javascript file to my services folder.
I added a div to my header.html file to call the javascript. According to Angular, the div should ...
0
votes
2answers
411 views
Angular directive data binding not working properly
I have been trying to write a shared directive for my angular apps that turns an input field into jquery timepicker.
I have two input fields, fromTime and toTime, and I want to update the toTime when ...
1
vote
3answers
227 views
How to dynamically disable ui-sortable directive in angular-ui
I am using angular-ui for sortable using ui-sortable directive. Is it possible to dynamically enable/disable sortable functionality based on the scope state? So I need to have a button which changes ...
1
vote
1answer
370 views
AngularJS remove attributes
I have a directive that replaces my custom tag with some regular HTML.
There are some attributes that I'd like to remove. For example, given the syntax
<ui mybutton ...
7
votes
2answers
328 views
When to write a directive?
Angular provides us with a mechanism to write directives - which is extremely powerful in what it can do. But the thing I keep wondering is - in what scenario should you be actually writing a custom ...
6
votes
2answers
1k views
Isolated scope with simple angularjs nested directive
Please check this plnkr
I have read everyhting can find about directives, scope and isolated scopes. But I still cannot understand the way to make this work.
The directive I created works perfectly ...
7
votes
3answers
1k views
What is the best way to conditionally apply attributes in Angular?
I need to be able to add for example "contenteditable" to elements, based on a boolean variable on scope.
Example use:
<h1 attrs="{'contenteditable=\"true\"': ...
2
votes
1answer
378 views
Angular directive to display Flash via <object> tag causes Flash to attempt to load {{expression}}
I have an AngularJS directive:
myApp.directive('movie', function(){
return {
restrict: 'E',
replace: true,
scope: { product:'=', codebase: '@' },
template: '<object ...
6
votes
2answers
595 views
How are the attribute prefixes “x-” and “data-” used in AngularJS
I'm new to Angular and trying to understand what the "x-" and "data-" prefixes mean. In the directives documentation (http://docs.angularjs.org/guide/directive) it says that these prefixes will make ...