0
votes
0answers
35 views

Using different controllers on the same directive in AngularJS

I have created a directive and service that combine to create a pop-up modal in our application. I can call the pop-up service which sets up a scope variable and causes a modal directive to become ...
-2
votes
0answers
24 views

Angularjs - sending data using https in angularjs

I am developing an mobile hybrid application using angular js-phonegap. I want to make a post call using https. is angularjs supporting https?
0
votes
3answers
23 views

How to access an object attribute inside a service in AngularJS?

I have a service with a local variable object with events names: myApp.service('appService', ['$rootScope', function ($rootScope) { var events = { firstEvent: "MyFirstEvent", ...
0
votes
0answers
26 views

Angular Widget using jQuery

I am trying to write a widget which will show up on button click. This is a jQuery representation of what I want to achieve. jQuery (This is not my code. Found this one on net) I am not sure how to ...
0
votes
1answer
31 views

How do i acces ngRoute's controller from directive?

I need acces to my controller that's provided by ngRoute in directive. Is it possible? Thank you in advance!
0
votes
1answer
28 views

How to run a directive after the dom finished rendering in Angularjs

I'm try to render the template dynamiclly, How to run the directive after {{tag}} has been rendered finished ? directive: angular.module('services', []) .directive('demo', function() { ...
0
votes
1answer
31 views

Angular JS. set ng-model correctly on repeatable select directive

Just started learning AngularJS. I wrote this controller and directive to repeat a select form item, because I need to do some server side work to populate its options. Here is the directive in HTML: ...
0
votes
3answers
32 views

Dynamically specify the controller to use in an Angular directive

I am looking to specify the controller that a directive should use via an attribute on the element - i.e. dynamically: HTML <div data-mydirective data-ctrl="DynController"></div> ...
1
vote
1answer
38 views

Directive does not have access to controller function (AngularJS)

When I declare a directive to use that accesses a controller function, it cannot find the controller. Here is my directive declared in app.js: app.directive("delete", function() { return { ...
3
votes
4answers
151 views

How to update a form controller in AngularJS after changing input constraints

I have been recently working on dynamically changing constraints on input fields on a form. The aim was to make a back-end-driven form, whereas all fields and their constraints are being sent to us by ...
0
votes
1answer
52 views

ng-repeat, ng-click, directive, and controller interaction

I have this directive snippet: return { scope: {}, restrict: 'E', templateUrl: 'partials/order_table.html', controller: 'OrderController as x', link : ...
0
votes
1answer
18 views

Directives not loading in order when navigating between pages that reuse directives

I have a two separate pages that use the same controller. I'm using ui router states to change between pages. They contain the following directives which use templateUrl for templates in order: Page A ...
0
votes
1answer
35 views

Modify elements based on data from ng-repeat

So i've just started learning Angular JS and i'm having troubles to do something that should be really simple but I can't figure out how to do it. Here's my problem... I have a Array of objects from ...
0
votes
1answer
45 views

Update directive variable from controller

New to AngularJS I have a simple directive, service and controller. I loop through a list of items from a database in the controller embedded in the directive to render a checkbox list of items. From ...
1
vote
1answer
91 views

Sharing a controller scope between two directives with isolate scopes in AngularJS

I have two directives that provide different views on the same set of data. Both of these directives need to rely on central functionality contained in a controller. The controller uses various ...
1
vote
1answer
49 views

AngularJS directive using another controller

I'm trying to create a directive that will output a HTML-template that is using data from a controller. In sample.js I've added a module, controller and directive var app = angular.module("myApp", ...
0
votes
1answer
53 views

Where to put in logic for manually adding and removing classes for an anchor tag - Angular JS

I have a main html page in which I have an anchor tag (looks like a button explained below), a drop down with some values and a check box. Code is given below. I have an anchor tag that makes it ...
0
votes
2answers
247 views

AngularJs Directives Loaded Event

I have just started using AngularJs directives, using the resources here, here and here. I have a situation where i need to do something after all directives have been loaded. i.e Scenario 1 ...
0
votes
1answer
55 views

angularjs app design multiple instances of the same component (directive or directive+controller)

My app needs to have multiple instances of a component that manages a complex model. to display the model and the UI/DOM logic including a template with child directives I'v created a directive, the ...
0
votes
2answers
80 views

Send Object From Directive to Parent Controller in AngularJS

How can I send an object back from a directive into the parent controller? I've defined the following directive: app.directive('inspectorSharedObjects', function () { return { restrict: 'E', ...
0
votes
1answer
99 views

Unknown provider: bProvider <- b

I have an AngularJS project with Directives and Controllers. After a while i got this error when I tried to run it: Error: [$injector:unpr] Unknown provider: bProvider <- b I have googled it and ...
0
votes
1answer
51 views

Call controller method from directive

I have a button which change the "active" state. First, it loads the status from the server <button active="data.active" ng-click="changeStatus()"></button> directive code: ...
0
votes
2answers
33 views

AngularJS accessing an attribute in a directive from a controller

I need to pass an Id defined in the directive to the associated controller such that it can be used in a HTTP Get to retrieve some data. The code works correctly in its current state however when ...
2
votes
1answer
224 views

How do I assign an attribute to ng-controller in a directive's template in AngularJS?

I have a custom attribute directive (i.e., restrict: "A") and I want to pass two expressions (using {{...}}) into the directive as attributes. I want to pass these attributes into the directive's ...
0
votes
1answer
34 views

AngularJS Directive or Service?

My current understanding of AngularJS tells me that Directives should only contain DOM Manipulation and Services everything which has to do with logic and data handling. In my case I'm unsure which ...
0
votes
1answer
18 views

Angularjs Error: registerService.getRegisterResponse is not a function

Error: registerService.getRegisterResponse is not a function I getting Above Error on console of the web browser. While Accessing the a method(i.e saveRegisterResponse()) from Controller (i.e ...
1
vote
2answers
165 views

ng-repeat inserting empty anchor tags

I'm trying to create a menu using angular. A menu item can have children requiring another ng-repeat to print the sub nav items. I'm noticing some strange behavior when attempting to insert an anchor ...
0
votes
1answer
141 views

AngularJS: Directive to Controller communication with scope.apply not working

I have a MainController and a nested Directive. I'm looking at this example to see how the communication works between controllers and directive, but mine doesn't seems to work. Basically, I want to ...
0
votes
1answer
287 views

How to pass $scope data between two partial files in angularjs

How can I pass data in two partial html files using angularJS, totally weird cant get through it. I have one index file [fine.], I login and reach view5 [partials/blog.html] which is written in ...
0
votes
2answers
35 views

how to fire a controller method from another controller or directive?

What I need is to show some values automatically when I process some data on another controller, but how can I fire my $scope.setOnController1 function on controller1 when the controller2 have ended ...
0
votes
0answers
194 views

Angularjs initialize multiple controllers at startup?

i have a normal navbar with a menuController, this is the parent. then i have two other controllers a DashBoardController this is loaded on startup and a LoadDataController this is called if i click ...
0
votes
1answer
88 views

How to override a controller function in an angular.js plugin

While developing my first Angular.js project I ran into troble. After a day-long research I have no idea how to override a plugin controller method. I am using a pretty nice ...
0
votes
1answer
49 views

How do I create a directive with a controller in a way where the scope will work without having to use $parent in the view?

I need to include a controller as an attribute of my-modal. In my example, showModal is not in scope unless I use $parent.showModal = false. I can't use $parent in the view for the sake of other ...
-1
votes
1answer
47 views

Angularjs HTML compilation in Controller

I am facing a small problem during the compilation of html code in angularjs. Here is the brief description of my problem : $scope.report= reportdata; reportdata is the html code that contains ...
1
vote
1answer
72 views

AngularJS Directive to Controller communication with “Controller as …” syntax

I'm using the "Controller as" syntax and am in a situation where I'd like the Directive to communicate with the Controller. I can get this to work when I do NOT use the "Controller as" syntax. ...
1
vote
1answer
31 views

AngularJS - How to get directive-controller in directive with “require”

I have a directive with a require. Now I want to get the required controller instance AND the controller of the directive in the link function. How is that possible? If i set 'require' the fourth ...
0
votes
1answer
147 views

Getting data from a Controller/Service into a Directive?

I'm a relative beginner with AngularJS and am writing an app that will have various reusable components (e.g. the same table may appear 5 times on the screen, with slightly different columns - I can ...
0
votes
2answers
75 views

angularjs directive controller $element

i see angularjs highly suggested not to do any dom manipulation in the controller, only setting the state of the scope, example pulling data from ajax etc, https://docs.angularjs.org/guide/controller ...
0
votes
2answers
97 views

Directive talks to controller but cannot call functions residing in controller

I have a directive which needs to call functions from the Main controller but everytime i try to reference a function inside the directive nothing happens because it's undefined. When I access a value ...
1
vote
1answer
16 views

How to append a directive to another directive which calls a function from controller.

I'm trying to append a directive which occurs when an event is fired via the $watch function in angular. The first directive updater would insert a custom element <confirmation /> into my view. ...
0
votes
1answer
82 views

Initiating directive from controller

I'm having trouble figuring out a way to initiate a directive once the data has been returned. I'm trying to build a report using html tables and ng-repeat. The report object is generated using a ...
0
votes
1answer
45 views

Angular directive - when to prefer using a controller inside a directive?

I've been seing a lot of directive containing a controller in it. What are the pro / cons /differences and use cases compared to put the same code in the link function of the directive ? One ...
1
vote
2answers
125 views

In an AngularJs directive, how do I call its controller's function contained within an directive element's attribute?

I am trying to call a function in a controller, which is part of a custom angular directive, following is the code, Method 1: (Doesn't work: Controller's function doesn't write to the console) HTML: ...
1
vote
2answers
204 views

How to pass async data from directive to controller?

I want to compile a third-party api (uploadcare) to a directive. The api will return the data info after uploaded in async then I want to do something with the return data in my controller but I have ...
1
vote
1answer
836 views

changing model objects inside controllers to manipulate DOM - angular js- Best practices?

I hava a simple question after reading the post below and working for some time now on angular js. the post : no dom manipulation from angular js controllers the concerned point (from the post) : ...
0
votes
2answers
305 views

Passing a callback form directive to controller function in AngularJS

I have a directive and a controller. The directive defines a function in its isolate scope. It also references a function in the controller. That function takes a callback. However, when I call it ...
0
votes
2answers
275 views

angularJS scope not updated for function attribute inside promise block

controller('SomeController', function($scope, simpleFactory, $routeParams) { init(); function init() { var myDataPromise = simpleFactory.getStuff($routeParams.id); // The ...
1
vote
2answers
479 views

AngularJS & Typescript: How to assign a class/type as a directive's controller?

AngularJS directives specify a controller using: { controller: function ($scope){} } As of yet, I have not found a way where I can create a TypeScript class and assign it to a directive's ...
0
votes
0answers
33 views

detect which directive calling a method in the controller

is there any way to detect which directive calling a function in the controller without passing any arguments from the directive itself. simple example to demonstrate what i need: controller: ...
0
votes
1answer
38 views

Angularjs app logic structure help required

I've recently started with Angular and would really appreciate some help on how to properly structure my code the angular way. This is more of a meta question rather then technical question. I have ...