angular-controller

Error: $controller:ctrlreg The controller with the name '{0}' is not registered

自闭症网瘾萝莉.ら 提交于 2019-12-10 13:31:12
问题 app.js (function(){ 'use strict'; angular .module('app', ['ngRoute', 'ngCookies']) .config(config) config.$inject = ['$routeProvider', '$locationProvider']; function config($routeProvider, $locationProvider){ $routeProvider .when('/', { controller: 'HomeController', templateUrl: 'home/home.html', controllerAs: 'vm' }) } })(); home.controller.js (function () { 'use strict'; angular .module('app') .controller('HomeController', HomeController); HomeController.$inject = ['UserService', '

AngularJS - Multiple Directive Instances making XHR call multiple times

孤人 提交于 2019-12-07 05:49:15
问题 I have an Angularjs directive 'ExampleDirective' which has the controller 'ExampleController'. The controller defines two Promise objects where each Promise object makes an Http GET request and returns the response. In the directive, we get the response data from the promise objects and process them to render the directive. ExampleDirective gets instantiated twice within the same view and each instance makes it's own Http GET requests. This causes performance issues on the front end due to

AngularJS - Multiple Directive Instances making XHR call multiple times

浪子不回头ぞ 提交于 2019-12-05 10:26:08
I have an Angularjs directive 'ExampleDirective' which has the controller 'ExampleController'. The controller defines two Promise objects where each Promise object makes an Http GET request and returns the response. In the directive, we get the response data from the promise objects and process them to render the directive. ExampleDirective gets instantiated twice within the same view and each instance makes it's own Http GET requests. This causes performance issues on the front end due to two requests sent at the same time to make expensive database calls and read from the same table as well.

AngularJS Upgrade (1.5 to 1.6,1.7) Makes directive scope bindings undefined

心不动则不痛 提交于 2019-11-27 02:06:15
I have the following code: angular .module('myApp') .directive('layout', function () { return { restrict: 'E', template: '<div ng-include="layoutCtrl.pageLayout"></div>', controller: 'LayoutController', controllerAs: 'layoutCtrl', bindToController: true, scope: { pageLayout: '=', pageConfiguration: '=', isPreview: '=' } }; }); angular .module('myApp') .controller('LayoutController', LayoutController); function LayoutController($scope, LayoutDTO, LayoutPreviewDTO) { var self = this; self.layoutDTO = LayoutDTO; self.layoutPreviewDTO = LayoutPreviewDTO; var test = $scope; if(self.isPreview) self