Search Posts

Category: angular-controller

How to transition an angularJS application to angular

I currently have a simple search functionality defined in AngularJS (https://next.plnkr.co/edit/qpyvZuvI8vw8q6on?open=lib%2Fscript.js&preview) but I’m hoping to migrate this feature into an existing Angular application. I created a new Angular application and moved the view into app.component.html <head> <script src=”./script.js”></script> </head> <h1> Search Feature </h1> <body ng-app=”search” ng-cloak> <div id=”content” ng-controller=”MainCtrl”> <input type=’text’ ng-model=’searchText’ placeholder=” Enter Query Here ” /> <ul> <li class=”angular-with-newlines” ng-repeat=”course in courses | filter:searchText”> {{course.course_number}}: {{course.title}} <button ng-click=”course.showDesc=!course.showDesc”>See More</button> <div ng-if=”course.showDesc”> Description: {{course.description}} […]

How to Use Highlighting Filter Through Angular Controller

I’m trying to highlight my search results based on the filter defined by this answer: https://stackoverflow.com/a/40719955/6521206 Based on this post (https://www.infragistics.com/community/blogs/b/dhananjay_kumar/posts/how-to-create-custom-filters-in-angularjs) it would seem that all I have to do is create a separate filter before the controller, but no search results seem to be highlighted. I’m relatively new to Angular so if this is just a simple syntax issue regarding declaring filters in controller, apologies in advance. Here is my code: https://next.plnkr.co/edit/qpyvZuvI8vw8q6on?open=lib%2Fscript.js&preview Thank you […]

Callback promise only work one time [duplicate]

This question already has an answer here: What happens if i reject / resolve multiple times in Kriskowal's q? 1 answer I’m creating a promise on my factory. It calls a worker and I need to create some callback event from the factory to the controller. It should answer every worker message. Callback is only working the first time of the call. Does anyone have idea why callback is not working properly? var worker = […]

Not loading test cases generated in karma-jasmine framework

I am trying to write a simple test case for a controller, but it doesn’t give any error as well doesn’t load the test case I have written. app.js var myApp = angular.module(‘myApp’,[ ‘ui.bootstrap’, ‘dialogs’, ‘ui.router’,’base64′,’ngtimeago’, ‘cfp.loadingBar’, ‘ngStorage’, ‘ngCookies’, ‘ngTable’,’ngRoute’, ‘angularUtils.directives.dirPagination’, ‘ngSanitize’,’ngTagsInput’, ‘ngIdle’,’angular.filter’,’angular-encryption’,’ngImgCrop’]); loginController.js myApp.controller(“loginController”,[‘$scope’,’$rootScope’,’$state’,’APIServices’,’$http’,’$localStorage’,’cfpLoadingBar’,’$log’,’sha256′,’MFEEDBACK_CONSTANT_MESSAGES’, function($scope, $rootScope, $state, APIServices, $http,$localStorage,cfpLoadingBar,$log,sha256) { var lc = this; lc.test = “hello”; } loginController.specs.js describe(‘Controllers’, function(){ beforeEach(module(‘myApp’)); describe(‘loginController’, function(){ var loginController; beforeEach(inject(function($controller,$rootScope){ var state,mockStorage,APIService,mockHTTP,mockLoadingBar,log,sha256,messages; var mockScope,mockRootScope = $rootScope.$new(); loginController […]

AngularJS read data from controller to table

I simply try to read out data from the balanceTableCtr and show it in the balanceTable. But it just shows me an empty table. balanceTableCtr.js: (function () { ‘use strict’; angular.module(‘BlurAdmin.pages.dashboard’) .controller(‘BalanceTableCtrl’, BalanceTableCtrl); /** @ngInject */ function BalanceTableCtrl($scope) { $scope.balanceTableData = [ { image: ‘app/browsers/chrome.svg’, algorithm: ‘SHA-256’, name: ‘Bitcoin’, price: ‘9843 $’, change: ‘12.6 %’, isChangeUp: true, amount: ‘2.452 BTC’ } ]; } })(); balanceTable.directive.js: (function () { ‘use strict’; angular.module(‘BlurAdmin.pages.dashboard’) .directive(‘balanceTable’, balanceTable); /** @ngInject […]

ANGULARJS :How to send radio button value from controller to another?

I have two radio buttons redirecting to same application.jsp page but I just want to add/remove few fields on that application based on button that is clicked. For example- if btn 1 is clicked i want to see NAME and EMAIL fields on the application page but if btn2 is clicked I want to see DOB along with NAME, EMAIL Question: I want to store button value in controller so that I can use ng-show/ng-hide […]

angularjs external controller file results in error ‘angular is not defined’

I have following controller defined in an external file but when I try to run my node server I get ‘angular is not defined’ error. vaultcontroller.js angular.module(‘demoapp.vaultcontroller’, []) .controller(‘vaultcontroller’, function($scope, appFactory){ console.log(“INSIDE APP CONTROLLER.”); $(“#success_holder”).hide(); $(“#success_create”).hide(); $(“#error_holder”).hide(); $(“#error_query”).hide(); $scope.get_all_currencies_from_vault = function(){ console.log(“VAULT CONTROLLER IS CALLED -1 “); appFactory.queryAllTuna(function(data){ var array = []; for (var i = 0; i < data.length; i++){ parseInt(data[i].Key); data[i].Record.Key = parseInt(data[i].Key); array.push(data[i].Record); } array.sort(function(a, b) { return parseFloat(a.Key) – parseFloat(b.Key); }); […]

AngularJs pass model value + model name to function in controller

$scope.populateMap=[{name: “ABC”, code: “123”}, {name: “XYZ”, code: “345”}] //Want to send model name + value of model Currently sending ngObject.MainObj.specificFormatObj <select ng-model=”ngObject.MainObj.specificFormatObj” ng-change=”ngObject.MainObj.specificFormatObj”> <option></option> <option ng-repeat=”i in populateMap” value=”{{i}}”>{{i.name}}</option> //CONTROLLER CODE JSON parse object to get name and code GOT parsedObj $scope.genericSetLookups=function (Obj){ // want to do something like get the ngmodel string + the value, currently only value comes in Obj.code=parsedObj.code; Obj.name=parsedObj.name }; So if i have 15 fileds, i dont have to write […]

i need to store the value in angularjs function

how to i need to store the value in angularjs function im having ng-change function in the name of myFunc() to store the response from html listitem. the respose value is getting saved in the local variable of the function but when i refresh the controller or page the values are deleted. i need to store the value during ng-change in myFunc() after multiple page or controller refersh the value will be stored in the […]

add selected value from dropdown list to database angularjs php mysql

i have a dropdown list and i can access the selected name through ng_model directive(selectedName) but My problem is when i try to pass the selected option value to the database it pass a null value the query get executed and text box values are passing properly the issue is with the dropdown option values.. what went wrong .. in the controller or with the php code mysqli_real_escape_string part. it’s confused .. any help <select […]

Next Page »