Tagged Questions
0
votes
0answers
6 views
AngularJS Directive: Build DOM from Data
I was working on building a partial DOM structure from a data model. So far I got all working in my directives / templates till the point when I have raw text mixed with inline content markup:
...
0
votes
0answers
19 views
AngularJS controller object to directive in link
Using angularjs, I am trying to populate a form dynamically and then submit the forms data via POST to a server.
I created a data variable in my controller (to POST later)
$scope.data = {};
Then
...
0
votes
0answers
11 views
AngularJs Directive: Using TemplateURL. Replace element. Add form input. Getting form.input.$error object
Not sure if this is possible but I'm trying, and keep coming up short.
http://plnkr.co/edit/Gcvm0X?p=info
I want a 'E' (element) directive that is replaced with a more complex nested HTML node using ...
0
votes
0answers
24 views
Angular dynamically load content in directives
I am building an Angular application where I want to dynamically load different html templates based on where it was called from. I am new to Angular, so I may well be wide of the mark with this ...
2
votes
1answer
49 views
Angularjs pass multiple arguments to directive ng-repeat
I am stuck in a doubt I have html :
Here, there are two types of data : post and person. The json for each post has array of persons. I wish to retrieve the rating Value, dataCategory and id ...
0
votes
1answer
17 views
How can I sort a directive output?
I have the following Directive:
app.directive('sidebar', function () {
return {
restrict: 'E',
replace: true,
template: '<li ng-repeat="(keymenu, valmenu) in menu"><a ...
0
votes
1answer
22 views
Directive Inside another directive. Controller can't watch
I have 2 simple directives...
the parent directive:
.directive('modal', [function () {
return {
replace: true,
scope: {
/* attributes */
},
templateUrl: 'modal.tpl.html',
transclude: ...
1
vote
1answer
12 views
AngularJS: Getting text from TD in directive attached via an attribute and raising event in controller $scope?
I seem to have a small issue. I have created a directive and inserted the directive via an attribute on an existing DIV, see below.
<td my-directive>This Text I want to get hold of in my ...
0
votes
1answer
9 views
access child scope property in another child in angular js
is it possible to access sibling properties in angular js? I have a parent and two children
My parent is my parent div
children are:-
1. <li ng-repeat= "item in list"/>
2. and within ...
0
votes
0answers
27 views
ng-click="show… not working in directive
For the life of me I can't get ng-click="show''" to work in the directive correctly.
HTML
<sortable ng-controller="SortableCtrl"></sortable>
<div ...
1
vote
1answer
16 views
Angular testing a directive - find doesn't work as expected (or at all?)
I have this directive. it gets an array and creates a stacked bar. while the directive works fine, the unittesting failes miserably. I tried:
describe('Stacked bar directive', function(){
var ...
0
votes
1answer
19 views
Binding in directive linking not working
I am trying to make a simple directive work which will simply return uppercase text. The text is passed from a controller through a binding.
The basic idea is:
<div ng-controller="MainCtrl as ...
2
votes
1answer
46 views
AngularJS: What's the best practice to add ngIf to a directive programmatically?
I want to create a directive that checks if an element should be present in the dom based on a value coming from a service (e.g. check for a user role).
The corresponding directive looks like this:
...
-1
votes
3answers
33 views
Ng show if the variable is a number
I want to display an element only if a value is a number. How to do this? I tried :
ng-show='angular.isNumber(10)'
ng-show='isNumber(10)'
Thx
0
votes
0answers
11 views
How to create a directive in Angular JS for a Morris JS graph
I am trying to create a graph using Morris JS by creating an Angular JS directive. My directive code is:
Reporting.directive('morrisLine', function(){
return {
restrict: 'EA',
template: ...
0
votes
1answer
30 views
Validation directive code is executed on every item in ng-repeat
I am writing a single page application using Angular and Breeze. I have a set of entities displayed on my page using data-ng-repeat.
I am doing in place validation on the entities by having an "edit ...
1
vote
2answers
47 views
If else conditions in angularjs templates
I am quite new to AngularJs. I am working on a Q&A Application where i have to render some questions and its answers in the form of a table. I have three Types of questions which I have to render ...
0
votes
0answers
11 views
GWT with AngularJS and History Support or Deep Linking
I have a Web application which is built using GWT as a client side technology. This works as a single page app without browser's history/back-button support. It is not, we didn't want to have it. But ...
0
votes
0answers
10 views
AngularStrap Settings for locale
I want to use AngularStrap Datepciker with fa locale (AKA Farsi)
and Jalali Calendar . i find this
bootstrap-jalali-datepicker
but i dont know to use it
3
votes
1answer
31 views
Change image src based on ng-click index AngularJS
I have this angularJS code, the directive template defines:
<li ng-repeat="i in getNum(myNum)" ng-click="toggle($index)" id=$index>
<img src="img/{{ImgTest}}">
</li>
Also, ...
0
votes
0answers
15 views
Initiating a fancybox from inside a fancybox in AngularJs
I've updated my previous question by a complete rewrite so I can shed more details to you guys and have some pointers/help from you guys. Here's my scenario.
I am using AngularJs alongside jQuery in ...
0
votes
1answer
20 views
Conditional logic in compile or link function of angular js directive?
I have a JSON object in $scope called data. The object has a member called items which may either be an Object or Array of Objects. For this reason I can't use ng-repeat:
<ul>
<li ...
0
votes
1answer
10 views
angularJs directive template removal
in every angular template we have to define a root html node, then inside it we can define the Html of our directive.
is there a way in angular to ignore that root node?
example :
my directive ...
0
votes
0answers
6 views
How to combine RichMarker within angular-google-maps directive
Does anyone knows how to combine RichMarker within angular-google-maps directive?
Best regards,
Chen
2
votes
1answer
27 views
configure angularjs module to send patch request
I am totally new to AngularJs. I am trying to send a PATCH request using Angularjs to Django Tastypie API's. My code is
var module = angular.module('myApp', []);
module.config(function ...
0
votes
0answers
21 views
Angulajs - creating a directive while using ui-router
I am trying to decipher directives... although I viewed and implemented many AngulaJS simple stack tutorials, I am unable to get it to work while using ui-router, not sure why. Too many attempts have ...
2
votes
3answers
56 views
Angular interpret {{}} inside a link function of a custom directive
Is there a way to interpret the content of a div having my directive as an attribute :
example :
<div my-directive>{{1+1}}</div>
and my link function looks like this :
link = ...
0
votes
1answer
37 views
AngularJS ng-grid - Intialize grid after route is successfully loaded
Is there any way to load the ng-grid dynamically? i.e., the grid options should be initialized after the route change. Kindly have a look at the below code,
Method One:
app.js
var app = ...
0
votes
1answer
37 views
Directive requiring a parent
I need a directive ngTree to get the controller of a parent ngTree element. Note that require: "^ngTree" would return the controller of current directive.
I know I could do a ngTreeHelper and put a ...
1
vote
0answers
27 views
How to bring ng-table inside tab?
I've trouble having to implement the ng-table inside tab. I'm using ng-include to include the template into tab which contains ng-table attrubutes. When changing tab to tab ng-table not working?
When ...
1
vote
1answer
28 views
Testing d3 inside of an angular service
I have d3 visualization inside of my directive. The problem with that is that there is a lot of boilerplate code that can be reused across many other visualizations, like setting the element[0] to the ...
0
votes
1answer
25 views
Angular JS - load a custom directive based on current scope
What I'd like to achieve is a reusable tabbed element that can load in a custom directive based on the current active tab. A directive within a directive.
I've built the tab wrapper element and have ...
2
votes
1answer
44 views
angular directive leaking child contents out
I have a custom tag <my-tag> created with an Angular directive, and replace it with a simple <div> in the directive definition code:
.directive('myTag',function(){
return {
...
0
votes
1answer
30 views
passing model value from ng-repeat to ng-include to a directive using “=” in scope fails
i have the following code in my homepage
<ul>
<li ng-repeat="item in list" ng-bind-html-unsafe="item.Content" ng-include="item.Template" > </li>
</ul>
the value of ...
0
votes
2answers
32 views
Alternative way to bind directive
I know that you can bind a directive by:
html:
<mydirective />
js:
app.directive('mydirective', function () {})
However I saw this[1] SO answer. So is it possible to bind a directive ...
2
votes
3answers
40 views
Ng-repeat priority
I have the following:
app.directive("myDirective", function($compile) {
return {
replace: true,
scope: {},
template: "<div></div>",
link: ...
0
votes
2answers
58 views
How do I access ng-model values inside my directive template?
I have a directive with a template that looks like
<!-- selectList.tpl.html -->
<div ng-if="selectList">
<p>Id: {{$id}}</p>
<p>Current list item ...
0
votes
0answers
15 views
Syncing $viewModel with an input text inside an angular directive?
I try to build an angular directive for a numeric stepper based on an input text add plus 2 buttons for increment / decrement. I alse use a ng-model inside my directive.
<input
ui-stepper
...
0
votes
1answer
24 views
Create Hoverable popover using angular-ui-bootstrap
I have the following code for creating a popover in my template file:
<span class="icon-globe visibility" id="visibilityFor{{post.metaData.assetId}}" popover="{{post.visibilityListStr}}" ...
0
votes
0answers
29 views
how to add directives dynamically while using ng-repeat in angular js?
i have the following code on my homepage:-
<ul>
<li ng-repeat="item in list" ng-controller="controller1"></li>
</ul>
now item has various properties like item.type, ...
0
votes
1answer
31 views
Angular JS -: Scope Lost after formating through directive
I am facing an Issue when I am trying to format a json date to normal date by using a directive.
I am fairly new to Angular, Please suggest what am I missing?
My Html goes like this:
<form ...
1
vote
2answers
24 views
Angular directive: bind to variable in parent scope
Angular directive demo:
jsfiddle
<div ng-app="myApp">
<script>
function Contrl($scope){
$scope.parval = 0;
$scope.items = [
{id: 1, text: '1'},
...
0
votes
0answers
39 views
Focus first empty input inside html form in AngularJs
I am trying to focus first empty input inside a html form using angularjs directive. Here is the directive code which I have written so far (and applied on form element):
...
0
votes
0answers
32 views
getting Wrong url in Angular url
I have getting a problem with Angular js url.i have implementing app.js where all url mapping is done.my proper url is this for page.html "https://chanrjeetsingh.com/home/index#/page.html".
but i ...
0
votes
1answer
24 views
Should you use the linking function over the compile function when you can in Angular?
I want to learn more about compile function and transclusion and found this Plnkr. This code contains a advanced tab directive. Based on this directive I started to create my own to see what happens ...
3
votes
0answers
25 views
$render stopped working at angular 1.2.2 (file validation directive)
I have migrated from angular 1.0.8 to angular 1.2.2 yesterday, and beside a bunch of other things that got broken and I've already fixed, the $render function on the following directive is not firing ...
1
vote
1answer
44 views
Updating Angular JS directive when Service changes
I'm attempting to follow this SO answer explaining how to render a recursive JSON structure using a directive. However, unlike the answer provided, my data is not known when the DOM is loaded and ...
1
vote
1answer
36 views
ng-model changes of type in radio button
Please note this example:
JSFiddle Sample
<div ng-controller="myCtrl">
var ng-model = {{myValue}} - {{myType}}
<input type="radio" value="true"
name="boolean" ...
1
vote
1answer
184 views
AngularJS: How do I add an unselectable and customizable placeholder to a select box?
I've got a pretty large app that has many dropdowns. I don't want to have to modify my data to add a blank option and I don't want the placeholder to be selectable. What's the best approach?
0
votes
1answer
46 views
AngularJS - scope watch is not triggered athough ng-class has been updated
I am trying to implement a dropdown mega-menu using Angular, where if the user clicks on Link 1, then the content for Link 1 should appear. My directives are as followed:
mobile-menu which acts as a ...