Search Posts

Category: angularjs-controller

angular watch not fired

There is 1 angular app, with 1 parent controller, and a child controller. In the child, there is 1 $watch WATCH-CHILD for OBJ-CHILD, which triggers an $emit. In the parent, there is a listener for the $emit, we’ll call it ON-LISTENER, and a $watch WATCH-PARENT for OBJ-PARENT (which uses true as the 3rd argument). When the child’s OBJ-CHILD is changed, it triggers WATCH-CHILD, which triggers the $emit. The parent listener ON-LISTENER is fired, and changes […]

Using angularjs 1.5.8 and ui router and got controller not defined error

I am building spring boot website using freemarker and angularjs as front end, using the example from http://websystique.com/spring-boot/spring-boot-angularjs-spring-data-jpa-crud-app-example/ and I have three controllers, BookController, WarehouseController and StocklistController, Here my add.js code: var app = angular.module(‘BookInventoryApp’,[‘ui.router’,’ngStorage’]); app.constant(‘urls’, { BASE: ‘http://localhost:8080/SpringBootApp’, INVENTORY_SERVICE_API : ‘http://localhost:8080/SpringBootApp/api/book/’, WAREHOUSE_SERVICE_API : ‘http://localhost:8080/SpringBootApp/api/warehouse/’, STOCKLIST_SERVICE_API : ‘http://localhost:8080/SpringBootApp/api/stock/’ }); app.config([‘$stateProvider’, ‘$urlRouterProvider’, function($stateProvider, $urlRouterProvider) { $stateProvider .state(‘home’,{ url: ‘/’, templateUrl: ‘home’ }) .state(‘home.Warehouse’, { url: ‘/warehouse’, templateUrl: ‘partials/warehouselist’, controller:’WarehouseController’, controllerAs:’ctrl’, resolve: { warehouses: function ($q, WarehouseService) […]

Dealing with AngularJS services, $http and controllers [duplicate]

This question already has an answer here: Return http data from Angular service 2 answers I have a big problem in probably understanding how services work. Pratically, i wanted to develop a simple ToDo application with Bootstrap and AngularJS, but today, better understanding what services are, i have passed my “printToDo” function from the controller to the service; but something went wrong and after a whole day spent i cannot understand anyway what it’s broken, […]

HTTP GET Calling Multiple times in AngularJS Factory

I have created the angular Factory to get the results from the PHP and calling only one time but when I see in the Network its calling multiple times as shown below and its taking lot of time to get the response from PHP I have attached the screenshot of the Network Tab where I am seeing multicurl.php is called 3 times, Since it is very data I have to make sure its called only […]

Issue while creating a controller in AngularJS

I am new to AngularJS. I am working on login functionality using forms in html and angularjs. There are three files 1. index.html 2. app.js 3. LoginCntrl.js I have included both the js files in .html file but the ng-controller is not working. It isn’t taking values from controller and not even calling functions in the controller. The js files are being executed but I think there is something wrong in my html file. Here […]