Tagged Questions
0
votes
2answers
323 views
Angular UI select2 with tags not working inside custom directive
Using the Angular UI Select2 directive, with tags defined on an input field. If the input is itself inside a custom directive, then it is not initialised correctly and the console gives an error:
...
0
votes
1answer
41 views
angular 2-way binding broke when creating new child scope in directive
I am using custom angular form validation to validate fields based off the field having a value AND the selected value of a drop down. I use the same section of code (and therefore the same directive) ...
0
votes
1answer
28 views
AngularJs pass instance of each ng-repeat in HTML to directive
I'm thinking this should be simple but I'm missing something. How can I pass a flowObj in my ng-repeat below to my Directive? I want to pass it to my directive then on click use that FlowObj then ...
0
votes
2answers
39 views
The attributes passed to directive in angularjs change only into directive scope but not outside
I want use the directive to customize my code.
i have followed button that responsible to switch isCollapsedUpload flag defined in controller as: @scope.isCollapsedUpload=false.
When user press on ...
0
votes
1answer
23 views
AngularJS: ngInclude and dynamic URLs
I'm using the ngInclude directive to load HTML fragments. Now I'm looking for the best way to pass a dynamic URL. I know I can create the URL with string concatenation:
<ng-include src="'/foo/' + ...
1
vote
2answers
36 views
How can two directives (that are not nested in HTML) communicate with each other?
im pretty new to angularJS and I got a question (hope it's not that dumb):
I got 2 directives (not nested):
<div directive1></div>
<div directive2></div>
Now i want the ...
1
vote
2answers
44 views
AngularJS directive and pulling data from a service
I am trying to figure out the correct way to pull data into my directive from a service. For some reason my $watch statement isn't triggered when the data is loaded.
link: function(scope, element, ...
0
votes
1answer
35 views
How to call an application controller method from angular js directive
Hi I want to make a validation directive. It basically will call a remote validation on the server. I would expect something like this:
<input type="text" id="nome" required ...
0
votes
1answer
20 views
angular js directive - How to evaluate angular tags of directive's template html
I have a directive whom's behavior I want to control using attributes. It's a navbar that should should have an active item depending on the value of an attribute
<navbar ...
0
votes
2answers
276 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 ...
1
vote
2answers
80 views
Is there a way to create custom animation events with AngularJS
Is there a way to create a custom animation event with angularJS. I am trying to create my own event of trigger an event on my own. I'd like to do the following
<div ng-animate="{myEvent: ...
0
votes
1answer
17 views
Filter items by data type in ng-repeat in Angular.js
Is it possible to filter a collection of items by data type (not by value) using the ng-repeat directive in Angular.js?
I have a custom data type via a constructor called BookCollection. Each ...
-3
votes
1answer
33 views
AngularJS : Watch element.html() in a directive
I am looking to create a mardown directive (restrict A) which would make me able to use same recipient for ng-view. So I would basically load only .md files in views and apply my function on its ...
0
votes
3answers
31 views
How to surround text with tag conditionally in AngularJS?
How to surround text with tag conditionally in AngularJS?
for example:
function Controller($scope){
$scope.showLink = true or false, retrieved from server;
$scope.text = "hello";
$scope.link = ...
0
votes
1answer
24 views
How to mock required directive controller in directive UT
According to AngularJS doc a/the directive controller is:
instantiated before the pre-linking phase and it is shared with other directives if they request it by name (see require attribute). This ...
0
votes
1answer
21 views
Binding multiple HTML attributes with AngularJS ngModel
I'm new to AngularJS, so forgive me if this is a noob question. The documentation is pretty terse, so I may have missed something obvious!
I'm considering migrating a bunch of custom in-house code to ...
0
votes
2answers
45 views
Passing variable to directive template without creating new scope
Is there a way to pass variables using attributes to a directive without creating a new scope ?
HTML
<div ng-click='back()' button='go back'></div>
JS
.directive('button', function () ...
0
votes
1answer
31 views
Using FullCalendar methods with AngularUI wrapper
I'm trying to integrate AngularUI's calendar wrapper into my application, and the calendar initialization works fine. However, I don't see how I can call calendar methods from here. Here's my ...
0
votes
0answers
46 views
Angularjs load templates with directive
I have a directive that lets me insert a chat component. It loads a template as required.
mod.directive('chat', function () {
return {
replace: true,
templateUrl: '/tmpl/chat/chat',
}
})
...
0
votes
0answers
23 views
Angular Directives: I have to call $apply twice?
Here's the deal. I have a page where you just edit a user. It has basic inputs and everything. I then created a directive to handle uploading of images through ajax:
angular.module('fileDirectives', ...
0
votes
1answer
110 views
Using Angular + JQuery for a Dynamic Pinterest-Style Layout
I'm relatively new to Angular and have very little experience with JQuery, so whatever insight/advice you can give me would be greatly appreciated.
My goal is to build a dynamic Pinterest-style ...
0
votes
1answer
72 views
Use angularjs to post JSON without a parameter name
Currently I have a resource like so:
return $resource(usersUrl, {}, {
//The data model is loaded via a GET request to the app
query: {method: 'GET', params: {}, isArray: false},
...
2
votes
1answer
61 views
AngularJS - Refresh ngRepeat Array Data at Event
I'm migrating my jQuery app to AngularJS.
What I need to do, is change the Data Array when a scroll occurred, how can i do this?
I have this code with jQuery at plunk:
...
5
votes
2answers
215 views
AngularJs: Run Directives after View is fully rendered
I'm new to all Angular World, and i'm facing a problem managing the directives.
I'm working on a project that uses Tabs, and i want to extend its functionality to handle overflowed tabs when window ...
1
vote
1answer
37 views
AngularJS: show hide elements based on mouse events
Here is an example - http://plnkr.co/edit/iwvjJcUurUW2AvkDArfz?p=preview
I would like the delete button to show up only when mouse hovers on the row and perform some function delete(name), by passing ...
0
votes
0answers
31 views
Dynamically disable tooltip when element becomes disabled
I am trying to prevent a twitter bootstrap tooltip from showing when the element is disabled. I am able to do so with the following code:
app.directive("tooltip",function(){
return {
...
0
votes
1answer
29 views
Angular directive: How to make assign value to parent scope?
I have a controller AppCtrl as
scope.transaction = {}
The index looks like
<div class="control-group">
<label class="control-label">Date</label>
<div ...
0
votes
2answers
171 views
Angular JS slide animation
I'm using v 1.1.4 so that I can use the ng-animate directive with ng-show.
I've got a fade working great on one part of my app, but having a bit of trouble getting a slide in panel to behave.
If I ...
1
vote
2answers
38 views
How can I get directive to fire after view loaded?
I know this has been asked a thousand time, but I think I've tried every solution I've read and I can't seem to get it to work.
I have an API from which I'm getting my images, after pulling the ...
0
votes
0answers
32 views
dynamic directive compile passing the right scope
I have dynamic directive which compiles any given directive, the problem is on compile function i need to provide a right scope to it, Jus thinking how to do this?
example of my directive below, ...
0
votes
1answer
65 views
Call jquery plugin in directive only after data is renderer in DOM
I want to initialize a jquery plugin in an angular directive but only after the service data is returned and first renderer in the DOM.
I can seem to figure out how to do this in angular directive.
I ...
0
votes
1answer
42 views
What's the best way to DRY in Angular within Django?
I'm new to Angular, and to Django, and to DRY (Don't Repeat Yourself) so forgive me if this really simple and obvious... I've somehow missed it.
I have a dozen or so partials and a couple of them ...
1
vote
0answers
24 views
Nested directive inside template is placed at the top
I'm having issues with an angularjs directive I'm attempting to make.
The main directive is called tableu, which has a tableu-heading and a tableu-body, both of which are inside a table like so:
...
1
vote
2answers
73 views
flot chart in angular.js directive has zero dimensions
I have followed the sample code that embeds a flot chart inside a angular.js directive: https://gist.github.com/jrmoran/3966529
The problem is that the outer chart element ends up being of zero width ...
0
votes
2answers
85 views
Angular (directive newbie): How to add date time-picker to ngModel so that it can be validated?
I am very new to Angular and have a specific use case in mind
I have a form which has two fields - Name and datetime.
The name is ng-model but datetime is not since it is not part of Angular and is a ...
0
votes
1answer
33 views
Extracting Data from Child Elements and Using it in Directive
I'm trying to create a generic directive that I want to use to display a flexible, spreadsheet-like data entry form.
I'd like to put all data structure & formatting information in the html code ...
0
votes
2answers
42 views
Angularjs: models binding
I have directive which dynamically creates input tags. I need to get values of created inputs on change event. Instead of it the name attribute on $scope argument in the controller is undefined. How ...
2
votes
1answer
57 views
Angular.js: Using a directive inside an ng-repeat, and a mysterious power of scope '@'
If you prefer to see the question in working code, start here: http://jsbin.com/ayigub/2/edit
Consider this almost equivalent ways to write a simple direcive:
app.directive("drinkLonghand", ...
0
votes
1answer
26 views
Dynamically include a directive in another directive
I have a directive called table-div which renders the header and body of a table. Each row within tbody could add some extra functionality or not. In case it has this ability then a custom directive ...
1
vote
1answer
21 views
How to acces model from inside directive when model changes in controller $scope?
I'm trying to get when the value inside the directive changes from outside and it seems it does not work with either scope.$watch or attrs.$observe.
I have a fiddle here.
...
0
votes
1answer
57 views
Binding a jquery generated hidden field to angularjs model in a directive
I'm trying to create a captcha directive using the http://keith-wood.name/realPerson.html jquery plugin.
I'm relatively new to angularjs, and can't seem to find a way to do this. Basically I want a ...
0
votes
1answer
24 views
How to re-use angularjs directives in your own directives
I am doing an exercise of wrapping an existing ngDirective without using a an html template fragment. In the example, I am merely repurposing an ng-show. I realise there are problems with this (eg ...
0
votes
1answer
37 views
Get all selected checkboxes and their associated attributes using angular
I need to be bundle selected checkboxes together to POST to my server. In each checkbox's attributes, I'm storing some two important values: "pos" (part of speech), and definition. I need to run ...
4
votes
1answer
113 views
Endless scroll doesn't work in AngularJS when scrolling over a ng-view
I am using code like this to create an endless scroll effect in AngularJS. I tried to refactor some of the code, by moving the content of the scrollable container (in this case the ul) to a seperate ...
2
votes
2answers
49 views
AngularJS what does locals in directive stand for
AFAIK this is not documented, but I found in angular source a locals attribute in a directive example:
angular.module('transclude', [])
.directive('pane', function(){
return {
...
1
vote
2answers
64 views
ng-click doesn't work within the template of a directive
Angular noob here. I am creating a directive to recursively display a tree of questions and sub questions. I am using a link in the template which calls a function within the scope. For some reason, ...
1
vote
2answers
59 views
AngularJS Scopes and Deferreds
I have a service that does something hard and returns a promise:
.factory('myService', function($q) {
return {
doSomethingHard: function() {
var deferred = $q.defer();
...
1
vote
3answers
673 views
Jasmine tests AngularJS Directives with templateUrl
I'm writing directive tests for AngularJS with Jasmine, and using templateUrl with them: https://gist.github.com/tanepiper/62bd10125e8408def5cc
However, when I run the test I get the error included ...
0
votes
1answer
45 views
AngularJS - Setting a variable on scope from directive
I'm trying to set a variable, selected.child, on the $scope so that I can use it elsewhere. I'm still new to scopes in Angular, but not sure why I can't set something on the scope from within the ...
-1
votes
0answers
32 views
Passing AngularJS attribute directive (e.g. ng-click) in a custom directive does not work
I have the following directive:
app.directive('axBtn', function() {
return {
restrict: 'E',
replace: true,
scope: {
icon: '@'
},
template: '<a><i ...