Posts

Showing posts from September, 2017

Why I should extract three times the infromation from Facebook crawler to get my site information

I have a site made with AngularJS where in order to get the right information from Facebook to share the link, I need to go first to Facebook crawler and extract the information three times before getting the right data. The first time, I get the default information The second time I get the title and the description of the specific page, but not the image. The third time I get the full information (including the image). But as the site allow the user to upload information and create dinamically new pages, if they try to share the deepling they won’t get all the information at least they go to Facebook scrawler and make it search the page three times… Im’m using prerender to get the page dinamic information The page is for example: https://www.granojo.com/video/10403 Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/30/why-i-should-extract-three-times-the-infromation-from-facebook-crawler-to-get-my-site-information/ via @lzomedia #developer #free...

Appending a list iterating in AngularJS to the HTML DOM

So I have an AngularJS function that when called should add a list element to a div in the DOM, and the list should be ng-repeat so that it could iterate on objects from a list. These objects in the list contain a few properties which I want to print out. Part of the AngularJS program var el = angular.element(document.getElementById('categories')); el.append('<ul id="' + categoryItemStr + '"><li ng-repeat="item in categories[currentCategory]"><h4 class="h4"></h4><br><span style="font-size:11px;">.00 $</span></li></ul>'); But when I run it it’s not ng-repeatable and it looks like the javascript hasn’t rendered. It’s important to note that I have the same HTML already in the document when the page loads and it works fine when it doesn’t come out of an angular function but is written inside the HTML document. How do I fix this? Source: AngularJS from Angular Que...

angularjs: Error: Firebase Database (4.3.1) INTERNAL ASSERT FAILED: Missing index implementation for isEmpty

I try to read some data from firebase, but my logic doesn’t work.. the problem seems to occur when I create a database ref. my lib version: AngularJS v1.6.5 AngularFire v2.3.0 Firebase v4.3.1 My firebase db: { "post" : [ null, { "message" : "hi", "name" : "Mario Rossi" }, { "message" : "hi", "name" : "Alessia Gallina" }, { "message" : "hi", "name" : "Stefano Macchi" }, { "message" : "hi", "name" : "Roberto Singapore" }, { "message" : "hi", "name" : "Elena Soghi" }, { "message" : "hi", "name" : "Bet Bet" } ] } my controller: (function () { 'use strict'; angular.module( 'messenger' ) .controller('fireGetPost', [ 'FIREBASE...

Can we use J hipster to develop android app?

I am new to develop android application, I have to develop android application with J-Hipster, so is this possible to develop android application with J-Hipster ? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/30/can-we-use-j-hipster-to-develop-android-app/ via @lzomedia #developer #freelance #web #lzomedia.com

How to attach event to dom created in link function

I know that dom created in template function can be attached to an event in controller.As: angular.module('app', []) .directive('appClick', function(){ return { restrict: 'A', scope: true, template: '<button ng-click="click()">Click me</button> Clicked times', controller: function($scope, $element){ $scope.clicked = 0; $scope.click = function(){ $scope.clicked++ } } } }); As there is no scope in template so I have to use link function. The same how can I achieve in link function. Like: angular.module('app', []) .directive('appClick', function(){ return { restrict: 'A', scope: true, link:function(scope, element, attrs){ element.html('<button ng-click="click()">Click me</button> Clicked times') }, controller: function($scope,...

How to get a value out of an array in typescript?

I have an array that looks like this const array: any[] = [] array.push({ 'Comments': this.comment, 'Name': this.name, 'Description' : this.description }) I pass that array back to a parent component. How can I grab the value that is in Comments? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/30/how-to-get-a-value-out-of-an-array-in-typescript/ via @lzomedia #developer #freelance #web #lzomedia.com

How to change only specific color of radio button in angular?

I have crated angular application for examination in which user gives exam and finally show full report with selected answer I have used ng-repeat for radio button to show options and I want to show user has selected answer and corrected answer if user has selected wrong than its should be red else green but it I have checked using conditions but it changing all radio button colors here is code <div class="md-radio" data-ng-repeat="data in vm.examQuestions.allOptions track by $index" ng-class="{correct:vm.examQuestions.attemptQuestions.yourChoice === vm.examQuestions.correctanswer || vm.examQuestions.correctanswer === vm.optionsArr[$index], 'has-error':vm.examQuestions.attemptQuestions.yourChoice !== vm.examQuestions.correctanswer}"> <span class="lblOption"></span> <input type="radio" id="" name="radio" class="m...

AngularJS login two different files

I have 2 files, one you have to login and the other one you are logged in. This is the form login: var monarchApp = angular.module('monarchApp', ['ngRoute']); monarchApp.controller('loginController', function($scope, $rootScope, $location){ $scope.username = "admin"; $scope.password = "pass"; if($scope.username == "admin" && $scope.password == 'pass'){ $rootScope.loginStatus = true; console.log($rootScope.loginStatus); window.location.replace('main.html'); } }); But when I’m at the Main.html is can’t find the $rootScope.loginStatus . I thing the problem is window.location.replace(); that he does not take the rootScopes with him. Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/30/angularjs-login-two-different-files/ via @lzomedia #developer #freelance #web #lzomedia.com

AngularJS Upload image sending post through $http function

I recently tried to code an upload script which is not really working as it should. The goal is to send a Picture through POST method, using the $http function built in AngularJS. So I’m basically using AngularJS to get datas from my own API REST and insert them to the dom, my front server and my back server are separated. But as i want to upload my files directly on the front server, where you only get the DOM features, i decided to create a small script outside my API called upload.php, a little bit like that: ./index.php (get datas and show templates) ./upload.php (upload data) But here is the trick. My PHP file is a module outside my main framework, which is the only real php script on my front server. It’s working fine, but When i try to use it in background with some js, everything goes wrong. I can’t send datas, or I’m receiving something php cannot read. It’s starting to mess with my minds as I learned JS all by myself with no outside help. So here is the PHP script, the...

Node delivering same js files repeatedly

I am developing a node application using express. I have a index.html file which has path of all js files which is delivered using express. I have written a directive navigation for nav bar. Whenever I am using navigation directive express is continuously delivering same files repeatedly.But this problem does not happen when I do not use directive. I am not able to figure out why it is happening. Here is directive for navigation (function () { angular.module('wp').directive('navigation', navigation); function navigation() { return { restrict: 'EA', templateUrl: '/commons/directive/navigation/nav.template.html', controller: 'navigationCtrl as navvm' }; } })(); navigationCtrl: (function () { angular.module('wp').controller('navigationCtrl',['$location', 'authentication', function($location, authentication) { var vm = this; vm.isLoggedIn = authentication.isLogg...

Using $rootScope and $broadcast to communicate between functions

In my app I have one page that shows the details of a particular users document in which a document can be deleted and another that shows the users recently viewed documents. I’m trying to make it so when a user deletes a document in the view page it also deletes the listing in the users recently viewed documents history. I’m attempting to use $broadcast and $rootScope to communicate between the two modules but I suspect I’m doing something wrong with the syntax or there’s an issue with scope or project structure. Here’s the two separate functions that delete the different entries history.js //gets the selected item the user clicks and deletes it and updates history $scope.removeFavorite = function(item) { var items = $scope.recent[item.type]; item = items.splice(items.indexOf(item), 1)[0]; $rootScope.$on('deleteRecent', function(data) { historyManager.remove(data); }); historyManager.remove(item).then(loadHistoryItems, loadHistoryItems); }; documentView...

Ionic 3: ng-change doesn’t work

I have a input field where a user can input his address and get auto-suggestions: <ion-label color="primary" stacked>Adresse:</ion-label> <ion-input type="text" ng-model="autocomplete.query" ng-change="updateSearch()"></ion-input> My class has a update method where i want to do something, but unfortunately he doesn’t get into it. updateSearch() { console.log('aaa'); if (this.autocomplete.query == '') { this.autocompleteItems = []; return; } } Any ideas? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/ionic-3-ng-change-doesnt-work/ via @lzomedia #developer #freelance #web #lzomedia.com

flipping issue..initially it loads back side.. I want to load flip-front side first

<div class="row"> <div class="flex-match-height"> <div class="col-sm-12 col-md-6> <flip flipped="ctrl.toggleFlip"> <div class="flip-front"> <tile> <tile-tabset> <tile-tab title="A"> <customer-detail external-data="something"></customer-detail> </tile-tab> <tile-tab title="B"> <co-customer external-data="something"></co-customer> </tile-tab> <div class="icons pull-right"> <a href="javascript:void(0)" class="btn btn-icon" ng-click="ctrl.handleFlip($event)" title="C"> ...

How to customize tooltip on mouse hover of a polar area chart of Angular Charts

Image
I have a polar area chart built with Angular Chart, as it follows: I need to customize what’s written in the tooltip mouse hover (Right now it shows [label: value], or [MBA010: 98.69], as in the image), or remove that option completely. I have tried applying the options as shown in this plunker , supplied by a similar question : // Controller $scope.chart_options = { tooltipTemplate: function(label) { return label.label + ':' + label.value; } }; <!-- View --> <canvas class="chart chart-polar-area" chart-data="module.data" chart-labels="module.labels" chart-options="chart_options"></canvas> But these options don’t work on the polar area chart, although it works on all the other chart types. How can I customize, or remove, tooltips on mouse hover for this particular chart? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/ho...

Can’t find role when adding user to role in Asp.Net API Controller?

So, just when I finally thought I had understood the Microsoft Asp.Net Identity Role System … I run into a new problem… I have a working controller that does my role management but I had problems in the view so I decided to use angularjs for my Web-Apps Admin-Panel. Everything seemed to work after a bit of hacking but now I’m at a point that I don’t understand at all. My process: Admin presses a button, which passes a user ID (string) to an angular Controller. Angular makes a POST Request to my ApiController, passing the userID to a Controller action that is supposed to authorize my user. Here is my API Controller: public async Task<IHttpActionResult> changeAuth() { string userID; var requestData = HttpContext.Current.Request.InputStream; using (StreamReader sr = new StreamReader(requestData)) { userID = sr.ReadToEnd(); } Models.ApplicationUser user; try { user = await UserManager...

ng-show working with multiple filters in ng-repeat

I have an ng-repeat list with multiple filters, but as I need the elements to be hidden and not removed from the DOM , I use ng-show for the filtering. This is how my first filter look like: <a href="" ng-click="myFilter = ''; toggle = toggle=0; togglesec=0; mySecondFilter = {}" ng-class="{'active' : toggle==0}" > Tot </a> <a href="" ng-click="myFilter = 'pa'; toggle = toggle=1; togglesec=0; mySecondFilter = {}" ng-class="{'active' : toggle==1}"> Pa </a> <a href="" ng-click="myFilter = 'Reposteria'; toggle = toggle=2; togglesec=0; mySecondFilter = {}" ng-class="{'active' : toggle==2}"> Reposteria </a> And the second one: <div ng-init="togglesec=0; mySecondFilter = {}"> <a ng-click="mySecondFilter = {}; togglesec = togglesec=0" ng-class="{'active' : to...

Basic behavior of protractor with functions outside of the it block

I tried to source one function out in protractor so that it is outside of the it-block. Before the “outsourcing” it worked fine. That’s my Code: it('should delete a private linked clone', function () { let countPrivateLinkedClonesBefore; let countPrivateLinkedClonesAfter; vmPortal.navigationbar.navPersonalClients.click(); countPrivateLinkedClonesBefore = countPrivateLinkedClones(); console.log(Count of private linked Clones before elimination: ', countPrivateLinkedClonesBefore); vmPortal.personalClients.firstLinkedCloneRow.element(by.css('button.btn-danger')).click(); vmPortal.modalCreateMachine.btnModalDeleteMachine.click(); countPrivateLinkedClonesAfter = countPrivateLinkedClones(); console.log('Count of private linked Clones after elimination: ', countPrivateLinkedClonesBefore); expect(countPrivateLinkedClonesAfter === countPrivat...

A more object oriented Angular 1.5+ component

I can’t use Angular 2 where I am, but I like how it’s more object oriented (components are classes). We are starting to use Angular 1.5+ components and to eventually ease transition I was looking at using the new javascript functionality of classes to make components classes with Angular 1.5+. Partially just messing around here as well to see what I can come up with. The specific question I have is that when I define $onInit by setting it to a class function it doesn’t get called but when I define it as an anonymous function it does and I’m not 100% sure why. Any help would be great. A generic question would be does anyone have ideas around how to do this simulation of app.component() to javascript class? class Component { constructor(name, templateUrl, bindings, controllerAs) { app.component(name, { templateUrl: templateUrl, bindings: bindings, controllerAs: controllerAs, controller: this.controller }); } ...

AngularJS – disable if $pristine bug for inputs with pre-filled ng-model values

I have an input field that is pre-filled with a value from an object’s json property using ng-model, and I’m trying to disable a button if this input is either empty initially or if it has an invalid value. This works, but when the page loads with data already in the input box as a value, the input is treated as being $pristine, because it has not been touched, even though there is a valid value. Therefore, the button, which should be enabled because of the valid value, is still disabled. I can change the $pristine condition to (personalDetailsForm.niNumber.$pristine && personalDetailsForm.niNumber.$invalid), which correctly enables the button on load when there is a pre-filled value in the input, but if the pre-filled value is removed, the input isn’t treated as being invalid. Is there any way around this? HTML: <div input-field class="input-field col-xs-12 col-sm-6 col-md-2"> <input id="niNumberInput" name="niNumber" type=...

How do I reload an Angular partial for testing purpose?

I use the UI Router module in Angular (1). Typically it would look like myApp.config(function($stateProvider) { var helloState = { name: 'hello', url: '/hello', templateUrl: 'http://www.example.com/partials/helloWorld' } } Is it possible to reload this partial template forcefully during development where the source code keeps changing? Data changes can be mapped using two-way binding but that is not my scenario? I saw some answers related to the latter case. Is there something like $state.reload('state') kind of functionality? Is there a better way to test a partial from a development perspective? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/how-do-i-reload-an-angular-partial-for-testing-purpose/ via @lzomedia #developer #freelance #web #lzomedia.com

Augury doesn’t work when angular’s mode is dev

I want to use Augury to debug my angular project, and I have used isDevMode to make sure that the mode is dev, but it doesn’t work. The Augury hint that ‘ javascriptThis application is running in production mode and therefore cannot be inspected using Augury. If this is an Angular application, please rebuild your application in debug mode or remove the call to enableProdMode(). ‘ By the way, The project isn’t created by angular cli, and Augury can work well with the project created by angular cli in my browser. What was wrong ? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/augury-doesnt-work-when-angulars-mode-is-dev/ via @lzomedia #developer #freelance #web

angular 2 this._Router.navigate([‘/app/home’]); navigates to home page but previous page is still on home page

i can navigate properly with “this._Router.navigate([‘/app/home’]);” syntax but it keep all the previous page data on home page. Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/angular-2-this-_router-navigateapphome-navigates-to-home-page-but-previous-page-is-still-on-home-page/ via @lzomedia #developer #freelance #web

UI-SELECT does not send data through

I am trying to send data from through but it does not work. On the other hand, it works with . Whichmeans, <input type = "text" ng-model = "customer.selected"/> is working but not, <ui-select ng-model="customer.selected" theme="bootstrap"> <ui-select-match placeholder=""></ui-select-match> <ui-select-choices repeat="customer in customers | filter: $select.search"> <div ng-bind-html="customer.customer_company_name | highlight: $select.search"></div> </ui-select-choices> </ui-select> I have the controller.js as below which works fine. $http.post("../crud/projects_insert.php", { data_to_go : $scope.customer.selected }) INPUT works with the controller, but not the data from UI-SELECT. Does anyone have experienced same issue like this? Maybe I am missing something with UI-SELECT. The bold written is my question. Please advise...

Angular URL SRC in iframe desnt show up

I try to set up an iframe with src to youtube. The url inside an iframe is invisivble, when you inspect element in the browser. The same url pasted outside the iframe works perfectly. <iframe width="420" height="315" ng-src=""></iframe><br> you see this when you inspect element Do you have idea why it happens? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/angular-url-src-in-iframe-desnt-show-up/ via @lzomedia #developer #freelance #web

Way-points – How can i remove a specific way-point from google maps?

I am making this app with the help of google maps, i am successfully adding waypoints in a route and making a route between them. But on dbclick i remove that way point from the map. Now when i make the route it includes the deleted waypoint too. Because of the fact it does not delete from the waypoint array. The question is how can i remove a specific waypoint from the waypoint array. I dont have any index of something. pushing waypoints /* Whenever a user taps a pin it goes into pinwapypts */ pinwaypts.push({ location: $scope.destination_route, stopover: true, }); Add waypoints in map infowindow.open($scope.map, marker); $scope.markers.push(marker); google.maps.event.addListener(marker, 'click', function () { infowindow.setContent($scope.results[0].formatted_address); infowindow.open($scope.map, this); }); removing waypoint marker from map google.maps.event.addListener(marker, ...

Why does function in ng-show clause not keep on getting executed on each digest cycle

I am doing a test (while busy solving a different problem) I have a div element defined as follows: <div ng-show="myFunction()"> //some content </div> In my controller I have the following JavaScript function: $scope.myFunction = function () { console.log("myFunction called"); return true; } I was expecting that in the browser console, when running this code, I will keep on seeing the words “myFunction called” being written over and over and over since I expect the function to be evaluated on each angular digest cycle. But what I am seeing is that it gets called a finite couple of times and then it no longer gets called. Why is this? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/why-does-function-in-ng-show-clause-not-keep-on-getting-executed-on-each-digest-cycle/ via @lzomedia #developer #freelance #web

Angular popover issue

I am using angular popover to display content in popup. I have multiple records in table, each row contains one button, to click on that button I am displaying a popover. Here my issue is when i click on one button one popover is displaying, next I am clicking on second button second popover is also displaying and two popovers contains second popover content. My requirement is If one popover is already open I am trying to open another one first popover should close. please guide me to implement this requirement. Thank You, Java4you. Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/angular-popover-issue/ via @lzomedia #developer #freelance #web

Why not use Ionic for web applications rather than responsive Angular? [on hold]

Ionic has in-built grid system, stylish Progressive Web Application based design and angular inspired structure, then why not use Ionic always rather than using Angular (along with bootstrap) to give mobile look and feel? Using Ionic completely means using Ionic CLI, grid, buttons and all Ionic components. Thoughts?? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/why-not-use-ionic-for-web-applications-rather-than-responsive-angular-on-hold/ via @lzomedia #developer #freelance #web

Need a folder to be routed making all the contains inside that folder available

Hi guys i need to actually route a folder which will be containing multiple files and folder inside it. For example My folder name is Contains -- with inner folder sample1 sample2. sample1 folder contains -- app.js index.js Index.html sample2 folder contains -- app.js index.js Index.html so I want routes for like every file in each folder's example -- localhost:3030/Contains/sample1/Index.html localhost:3030/Contains/sample2/Index.html localhost:3030/Contains/sample1/index.js localhost:3030/Contains/sample1/app.js ... etc How can I achieve this using stateProvider? Thanks in advance Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/29/need-a-folder-to-be-routed-making-all-the-contains-inside-that-folder-available/ via @lzomedia #developer #freelance #web

How to get selected value index dynamically using ng-options in angularjs

I am using select, in which I require selected value and dynamically created index (I don’t want to set default to [0] index) How it can be done. <div class="input-label"> Select Mobile </div> <select ng-model="mobile" ng-options="mobile as mobile.value for mobile in editContactModalData.phoneNumbers"></select> </label> Above is select option and below is input box where the selected value is set <label class="item item-input item-stacked-label" ng-show="mobile"> <input type="tel" maxlength="10" placeholder="mobile" ng-model="mobile.value"> </label> this is one modal and I want to show these changes of selected mobile in another modal the second modal consist <span></span> so in this in the place of [0] index i want to put dynamically selected value. S...

Unable to Invoke Angular4’s method from AngularJs?

I am trying to invoke Angualr4’s method by publish event from AngularJs. I am getting event inside Angular4’s method but not any things live inside angular4 component everything is undefined, So Unable to perform any activity in component. 1- public event as:- hub.publish('com.xxx.events.xx', id);// from AngularJs file 2- Suscibed here : this.hub.subscribe('com.xxx.events.xx', this.onClickCallBack); onClickCreateCallBack = function (topic, data) { console.log("Type:: "+this);//this object is undefined this.openPopup();//Since this is undefined not ivoking openPopup() } Observations :- I am booting my Angular4 application by Api call which return all bundles(main bundle, pollyfilles buldle etc..) in form of html response and I load that response in a div tag. So here I saw that my Angular4 boot 2 times first when whole environment(AngularJs + other stuffs) boots. And Second time when I click a Ta...

angularjs scope variables are not working but works on second click

Hi I am developing web application in angularjs. I have implemented print functionality. I am binding values to view using scope variables. When i click first time on print my values are not binding. When i click second time all my values will bind. Below is the print functionality. $scope.Print = function () { if ($scope.period == null) { toastr.error($filter('translate')('Please select Year.')); } else { $scope.vehiclepriceprint = $cookieStore.get("carpriceprint"); $scope.downpaymentprint = $cookieStore.get("downpayment"); } First time also i will be having values in cookie but not binding to view. Whenever i click second time on print button everything will be working Below is the print button. <input type="button" value="Print" class="blue-button" ng-click="Print()" id="btnPrint"...

Spring boot CORS Filter not working with AngularJS

I have created a SpringBoot application which has an AngularJS front-end and I am not using any Spring Security modules. I have added the @CrossOrigin annotation in my controller as follows @CrossOrigin(origins = "http://localhost:3000", maxAge = 3600) @RestController public class MyController { public static final Logger logger = LoggerFactory.getLogger(MyController.class); ..... ..... I have also created a CORS filter as shown below. @Component public class CORSFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) res; response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader(...

Loading address data into google maps from database using Angularjs

I am using angularjs for my application.I am trying to load the address from user_address table in database and display it on map on load. Here is the script i am using to load google maps <script async defer src="https://maps.googleapis.com/maps/api/js? key=myKey&callback=initMap"> </script> Here is the html <div id="map"></div> <div id="repeatmap" data-ng-repeat="marker in markers | orderBy : 'title'"> <a id="country_container" href="#" ng- click="openInfoWindow($event, marker)"> <label id="namesformap" ></label></a> </div> Here is the Controller.js var mapOptions = { zoom: 4, center: new google.maps.LatLng(25,80), mapTypeId: google.maps.MapTypeId.TERRAIN } $scope.map = new google.maps.Map(document.getElementById('map'), mapOptions); ...

$http.get is not giving response

I’m new to node and angular script. I’m having a function readDetails within my service which gives a GET request. this.readDetails = function() { return $http({ method: 'GET', url: '/getDetails' }).then(function(data) { return data; }); } Given below is my server side code. app.get('/getDetails', function(request, response) { fs.readFile('details.json', 'utf8', function(err, data) { if (err) throw err; var obj = JSON.parse(data); response.send(obj); response.end(); }) }) I don’t get the response from the server. I do not find Why. Suggestions are welcome Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/28/http-get-is-not-giving-response/ via @lzomedia #developer #freelance #web

populate and refresh html table using socket.io

I am making an application on using Node.js and angular as fronthand. There I am getting one text file which is log information of users and continously growing. The data is as below, 13:24:24:007,Peter,male,3720,yes 13:24:24:007,John,male,1520,yes 13:24:24:023,John,male,9720,yes 13:24:24:023,Mario,male,9820,no 13:24:24:023,Katy,female,4320,no 13:24:24:038,John,male,3620,no ..... ..... I want to show the aggregate report data in table format to the client html page for dashboard kind of thing as below. username firstlogin lastglogin minamount maxamount Peter 13:24:24:007 13:24:24:007 3720 3720 John 13:24:24:007 13:24:24:038 1520 3620 Mario 13:24:24:023 13:24:24:023 9820 9820 I am using socket.io to fetch data from server to client. Currently I am making aggregate data in two dimentional array and sending that compelete array to client. At client side, formating that array to display on html page. The problem is, i am sending entire array...

Using angular-js ng-disabled

I have this requirement where i need to disable a button based on some condition: Controller: <div ng-controller= "myController" class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 class="modal-title"> Add</h4> I need to disable this button when I have added 5 entries in html page.Can someone help me out? Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/28/using-angular-js-ng-disabled/ via @lzomedia #developer #freelance #web

Cannot call beforeEach ‘inject’ on angularJS (FUSE Admin) unit testing using karma

I used FUSE Admin app on my project – http://fuse-angular-material.withinpixels.com/apps/dashboards/project . I already checked other samples and even run this code on a different project and works just fine. IT’s just that I cannot inject the service, controller etc. on ‘beforeEach inject’, thus I cannot cont. my test. I don’t know what’s wrong or did I miss something (dependencies? not sure) while running this on FUSE. Do you have any idea? Here’s my code. SERVICE (the service returns a list of array) (function () { 'use strict'; angular .module('app.admin.users', []) .config(config) .service('adminUserService', service); function service(msApi) { return { adminUserList: function () { return msApi.resolve('admin.users.list@query'); } }; } function config(msApiProvider) { // calling the API (used dummy data) msApiProvider.register...

Angular Js Application Unable Authincate User Login with Wcf Service

Image
I am consuming Wcf Service into Angular Js Application . I have one Boolean function inside the wcf service to accept the username and password. I am trying to create user login system by using Angular Js Application but when I enter the correct username and password its does not working according my expectation. There are no errors showing in Google Chrome console windows. Here is Interface . [OperationContract] [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, //BodyStyle = WebMessageBodyStyle.WrappedRequest, UriTemplate = "/AuthenticateUser")] bool AuthenticateUser(UserLogin userLogin); Here is Implementation .. public bool AuthenticateUser(UserLogin userLogin) { // ConfigurationManager class is in System.Configuration namespace string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; ...

Ionic 3 app with firebase – How to edit a firebase list observable and make it display correctly in edit page

Image
So I have actually managed to figured out how to edit information from my ionic app and update it to firebase, however i’m trying to figure out how to get the current information from my list observable and display it in the ion-input fields. So when you click on an item you want to edit it opens an edit page and then in the ion-input fields it displays the current information that you can then edit. Here is my editpage.ts import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { AngularFireDatabase, FirebaseObjectObservable } from 'angularfire2/database'; import { AboutPage } from '../about/about'; import { AngularFireAuth } from 'angularfire2/auth'; import { Todo } from './../../models/todo'; @IonicPage() @Component({ selector: 'page-editpage', templateUrl: 'editpage.html', }) export class EditpagePage { todoDataRef$: FirebaseObjectObservable<Todo...

Custom component holder, which will dynamically create child component with min and max option

My requirement is to create panel with minimize and maximize button. based on maximize click of any child component only one should occupy whole parent holder container space and remaining should be hidden. Where I will have customCompoentHolder , in which I will define number of child component. like below <my-custom-minmax numOfcompPerRow="2"> <mycomp1></mycomp1> <mycomp2></mycomp2> <mycomp3></mycomp3> </my-custom-minmax> Here numOfcompPerRow will tell holder component, that how many child component can render per row, if more are there, it should create new row. And each child component will have own minimize and maximize button. I tried my-self to get list of child’s and then try to render. I am able to get list of child by having custom directive or by having base component. And I have use @Contentchilder , and it works properly. But creating component or rendering component using this.componentFact...

Why grid.appScope.value return undefined in celltemplate

In a grid celltemplate, I am tring the get a value which is in the parent scope of a grid like this <div sigef-entrees-sorties="grid.getCellValue(row, col)" type-flux="grid.appScope.typeFlux"> </div> but grid.appScope.typeFlux is undefined. So how can i get this value. Thanks. Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/27/why-grid-appscope-value-return-undefined-in-celltemplate/ via @lzomedia #developer #freelance #web

How to test Handsontable with virtual scrolling in Angular App using Protractor?

We use Handsontable in a hybrid AngularJS / Angular app that we test using Protractor. As far as I know we don’t use the available Angular wrapper for Handsontable but instead use it directly. Typical actions we would like to do in a fast way: Expand all collapsed columns in the table Read value of cell (x,y) Read all values in row y Change the value in cell (x,y) Currently we have two approaches to test Handsontable components: Using regular CSS selectors to find elements. This is pretty fast. But it only works if the table has no virtual scrolling, so that all elements are actually in the DOM. Using keyboard navigation (up, down, left, right). This also works with virtual scrolling, but it’s very slow. Do you know any other approaches that can speed up tests especially for larger tables with virtual scrolling? Is there maybe some way to talk to the Handsontable API directly from the Protractor test to scroll / select a certain cell in a table that has virtual scrolling...

Angularfire $firebaseArray extend dynamic countsum

Am trying to achieve a dynamic count of certain node if defined: This works but its not dynamic, you have to call sum(). app.factory("ArrayWithSum", function($firebaseArray) { return $firebaseArray.$extend({ sum: function() { var total = 0; var todayDate = new Date(); var start = todayDate.setHours(0,0,0,0); var end = todayDate.setHours(23,59,59,999); // the array data is located in this.$list angular.forEach(this.$list, function(rec) { if (angular.isDefined(rec.qa)){ if (angular.isDefined(rec.qa.completed)) { if (rec.qa.completed >= start && rec.qa.completed <= end){ total++; } } } }); return total; } }); }); I tried $$update but can’t access this_counter in array: app.factory("counter", function($firebaseArray) { return $firebaseArray.$extend({ ...

Angularjs $http request using rest api

So, I made a todo list using angularjs and made an api using php slim framework and mysql for task storage. I’m trying to use the $http service to save/delete/update tasks in the DB and so far, I came up with this (code below) but since I’m no expert in this matter, there’s probably a lot of crucial mistakes. Keep in mind that, the code regarding the todo list works fine and I’d like some guidance and tips for the $http requests. JS: var app = angular.module('todoApp', []); app.controller('TodoListController', ['$scope', '$http', function ($scope, $http) { $scope.todos = []; $scope.newField = []; $scope.customStyle = {}; $scope.date = new Date(); $http({ method: 'POST', url: 'http://taskapi.dev/api/tasks/add' }).then(function successCallback (response) { $scope.addTodo = function () { $scope.todos.push({text: $scope.todoText, done: false, editing: false, date: new Date()}); $scope.todoTe...

Angular CRUD to and from API

Image
I am trying to build a system that you upload photos add photos to array, save photos. When you save photo it posts to a API, also the Array is per populated with the current images saved to the API on last visit. So User uploads photos and sees a preview (Working) Click add and it adds the preview image to the array (NOT WORKING FULLY) Save updated array and post to API. (Working but dose not update array async) In Summery I need a array of images that is pulled from a API and the images can be deleted and added then saved back to the API. Things I need help with At the moment I print out the array from the API request separately to the array you add the preview image to to display on the front end. bellow you can see I am getting the base64 from the API and the images added from the preview. see photo bellow I need both to be the same, so on load of the page you seen all the images from the API with the delete button next to each image and also when you add image from p...

Send form data using AngulaJS not working

I want to insert user data into databse but I can’t send from data through angularjs and i am new to angular. I check by print_r($_POST) in insert.php but it displays as empty array.How can i send form data using php .please help me HTML <form name="form" ng-submit="signup()"> <div class="form-group"> <label for="Name">Name</label> <input type="text" class="form-control" placeholder="Enter your name" name="name" ng-pattern="/^[a-zA-Z]*$/" required ng-model="user.name"> <span ng-show="form.name.$dirty && form.name.$error.required">Enter your name</span> <span ng-show="form.name.$dirty && form.name.$error.pattern">Name in characters only</span> </div> <div class="form-group"> <label for="Mobile">Mobile Number<...

Show pdf and docx in html using angularjs and AWS S3

I’m working with AngularJS and AWS S3 and I’m trying to view the files(.pdf, .docx, .ppt, etc..) in the browser but I’m stuck. I’m trying to use the google docs view: <iframe src="http://docs.google.com/gview?url=MY_AWS_S3_URL&embedded=true"></iframe> But I’m getting this error in console’s browser and obviously the view of this doc is not working. Anyone know what is happening? Could be a S3 permissions error or maybe its because angularjs doesn’t support it? EDIT: I’ve tried this to show .pdf files and it works but just for .pdf files. <object width="400" height="500" type="application/pdf" data="your_url" id="pdf_content"> <p>ERROR!!</p> </object> Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/27/show-pdf-and-docx-in-html-using-angularjs-and-aws-s3/ via @lzomedia #developer #freelance #web

Where to place jQuery plugins in AngularJS [duplicate]

This question already has an answer here: How to use jQuery in AngularJS 4 answers I am a beginner to AngularJS. I need to know what’s the best practice to store jQuery plugins in the project folder. I have seen strong opposition to placing them in node_modules folder. Please tell me where and how I can include such plugins? I know about directives, just need to know how to include them in path. Source: AngularJS from Angular Questions https://angularquestions.com/2017/09/27/where-to-place-jquery-plugins-in-angularjs-duplicate/ via @lzomedia #developer #freelance #web

DatePicker being truncated in dataTable

Image
I have several datePicker in a dataTable , and a vertical scroll on that table. The issue is that when i open my datepicker, it doesn’t “pop outside” the datatable, but does something like this: Looking online i found that the solution could be to use the position:relative style on the parent of the datePicker , as stated on the Git page of the datepicker , but it does not seem to work on my case. Here the directive I use to modify the datepicker : var parent = $(elem).parent(); parent.css('position', 'relative'); var dtp = parent.datetimepicker({ format: "DD-MM-YYYY HH:mm:ss", showTodayButton: false, }); Any hint? Did i got something wrong? EDIT Here is the HTML of the datatable <div class="table-responsive" > <table id="newFornitures" class="table" datatable="ng" dt-options="dtOptions"> <thead> <tr> ...