Search Posts

Category: controller

Angular modules aren’t working

I have an angular app that I am trying to have pull from a controller and it’s not working. HTML <div ng-app=”app”> <div ng-controller=”shopItemController”> <div class=”itm” ng-repeat=”shopItem in shopItems”> <div class=”imag”></div> <h2>{{ }}</h2> <div class=”hf”>Buy it: {{ shopItems.price }}</div> <div class=”hff”>Earn it: {{ shopItems.altprice }}</div> <div class=”desc”><div>{{ shopItems.desc }}</div></div> <div class=”prog”><div>{{ shopItems.progress }}</div></div> </div> </div> </div> and here is the controller var shopItems = angular.module(‘shopItems’, []); var trophyEarns = angular.module(‘trophyEarns’, []); var app = […]

Cannot interpolate vm.value in template – AngularJS

So I am updating and modifying a project using Angular JS 1.2.25, so far getting the jist of it quite well, as I have never used it before but I have this problem which I cant work out what I am doing wrong. I have my controller where I have a value called vm.stageValue which is then called in template with an ng-if, so when the vm.stageValue increments it shows different containers. But whhen I […]

Laravel 5.6.12 how to redirect to plain html after login

I want to use my laravel installation as a session and request handler without using blade view templates. I’ve added an auth controller to the app with: php artisan make:auth And login, register, forgot password etc. all work perfectly. What I wanna do though is to redirect the user to an angular 4 single page app that resides in a subfolder named dashboard-dist in laravel root which I build independently from the laravel project. In […]

Pass json to angular controller

i want to pass a json file or object to an angular controller to use it with ng-repeat. My json object is stored in my index.js file and written to data.json. My controller.js file looks like the following: var fs = require(‘fs’); var jobs = fs.readFile(‘out/data.json’, ‘utf-8’, (err, data) => { if (err) throw err; }); angular.module(‘slrm’, [].controller(‘slrmctrl’, function($scope) { $ =; })); And thats my html file: <table class=”table”> <thead> <th scope=”col”>#</th> <th […]

accessing directive scope variable inside the controller [duplicate]

This question already has an answer here: Bindings on directive with Isolate scope not in scope sometimes 1 answer parentData is being assigned a value in the parent controller. testDir directive is being called in the parent html. <test-dir directive-data=”parentData”></test-dir> testDir directive: app.directive(‘testDir’, function () { return { restrict: ‘E’, scope: { directiveData: ‘=’ }, controller: ‘myctrl’, templateUrl: ‘view/myView.html’ }; }); myCtrl controller: app.controller(‘myCtrl’, [‘$scope’, function($scope) { $scope.newVar = $scope.directiveData; console.log($scope.directiveData); //printing undefined. console.log($scope); //prints […]

getting TypeError : XYZ is not a function in Angular

I went through few questions and trying to solve this issue, but not getting success yet. I am getting this error : TypeError: appService.load_All_EV is not a function. I used same way to call data from service in other controller and its working fine. This is my service. app.factory(“appService”, function($http) { return { GetApp: function() { return $http({ method: ‘GET’, url: ”, headers: { ‘Content-Type’: ‘application/json’ } }).then(function(response) { return; }); }, load_All_EV: function() […]

AngularJS HTTP Request with another function

I have a simple app that reads data from a JSON file and displays it in a webpage. That part works fine (the displaying). I now want to be able to sort through the table by toggling on the table headers using the orderBy filter in AngularJS … however, that’s where I have issues. What may I be overlooking? I feel like it has to do with the HTTP Function … could that be messing […]

Combine JSON for two POST in AngularJS

I am trying to combine response of one POST data with another input JSON so that it can do another POST function. Controller 1:- $scope.master = {}; $scope.addChild = function(net) { $scope.master = angular.copy(net); $“url”,$scope.master).then( function(data) { $scope.childData = data; $scope.dataName = $scope.master.Name; growl.success(“Created a new Child”); console.log(data); },function (data, status, headers, config) { growl.error(“Something went wrong”); }); console.log($scope.master); }; Now I want to add the response of this controller ie; $scope.segments = data; to […]

Next Page »