Search Posts

Why interval not work after ng-click?

I don’t know why after I click button but interval not work in HTML. I use angularJS to get count in every second. I just want interval start after click button. This HTML <button type=”button” ng-click=”start()”><span>Start {{hitung}}</span></button> And this JS $scope.hitung = 0; $scope.start= function () { var auto = $interval(function () { $scope.hitung++; }, 1000); }; I try this but interval not work and $scope.hitung always 0. If any one have solution please tell […]

DocRaptor PDF Response to Firebase Storage

I am trying to create a pdf from DocRaptor and save the response to Firebase Storage as a PDF. I am using Firebase Cloud Functions and here is my server side code to generate the PDF. exports.generatePDF = functions.https.onRequest((req, res) => { cors(req, res, () => { res.header(“Access-Control-Allow-Origin”, “*”); var config = { url: ‘https://docraptor.com/docs’, encoding: null, headers: { ‘Content-Type’: ‘application/json’ }, json: { user_credentials: “lIkVtN2xKAE7MeznC7f”, doc: { document_content: req.body.content, type: “pdf”, test: true, } […]

How to orderBy a value returned after function call which is in loop?

I am looping an object in view and calling a function which takes its members as parameters. The function returns me a value every time the function is called. I want to orderBy that returned value. But my problem is, that value is returned after function call and I cannot store the values in an array so that I can sort. <div ng-repeat=”member in current_project.members | orderBy : ‘?'”> <span class=”taskCompletionEst”> Estimated time: {{estimatedTimeSum(selected_date, member.id)}} […]

Angularjs Constant not working with controller Inline Annotation

I created a constant but it’s showing undefined when I add [ ] to the controller. When I remove it, the constant works. Please am I missing anything? app.constant(‘RESOURCES’, (function() { var resource = ”; return { USERS_DOMAIN: resource, API: resource + ‘q’, BASIC_INFO: resource + ‘/api/info’ } })()); -When the constant is called in this controller, it doesn’t work: app.controller(‘SampleCtr’, [‘$scope’,’RESOURCES’, function($scope, RESOURCES){ console.log(RESOURCES) // undefined }]); -This one below works because I remove […]

Cannot refresh view, both reload solutions I’ve found have crashed instead

I have created widgets from facebook and twitter. Because I’m using ui-router for my routing the script tags are in the index.html and the actual html is in my leagues.html file. So, when I first load the page the fallback shows ‘Tweets by …’. But if I were to refresh the page the widgets show up correctly. The solution I’d like to use is to automatically refresh the page every time I go to ‘app.leagues’. […]

Running angular project from Visual Studio Code results in ‘This site can’t be reached’ error

I followed the tutorial here: vs-angular-tutorial However after I added the chrome config to my launch.json file and hit f5 aI was met with a ‘this site can’t be reached’ error instead of the webpage. I did look into this a bit and if I run ‘npm start‘ or ‘ng serve’ in the folder before hitting ‘F5’ it loads correctly. Is this expected behaviour? There is no other way to jus tmake it work without […]

Changing jQuery to ionic

So I originally had this bit of jQuery code, working perfectly fine: <input type=”text” value=”name-var”/> $(“input”).keydown(function(e) { var oldvalue=$(this).val(); var field=this; setTimeout(function () { if(field.value.indexOf(‘name-var’) !== 0) { $(field).val(oldvalue); } }, 1); }); I have been tasked with making this code in ionic angular, and since I am extremely, extremely new at this, I’m having some trouble. This is what I have so far: @Page({ template: ` <ion-content> <input #orderCommentInput (ngModelChange)=”check()” type=”text” [(ngModel)]=”comment” /> </ion-content> […]

Submit array data with ng-submit get error Cannot read property ‘name’ of undefined

I want to submit a form with array data <form ng-submit=”processForm()”> <div class=”item item-text-wrap item-toggle” ng-repeat=”item in items | orderBy: [‘id’,’name’]”> {{item.name}} <label class=”toggle toggle-calm”> <input type=”checkbox” ng-model=”formData[$index].id” ng-true-value=”{{item.id}}” /> <div class=”track”> <div class=”handle”></div> </div> </label> </div> <div class=”item”> <button class=”button button-block button-calm”>Submit</button> </div> </form> In controller: .controller(‘ProcessCtrl’, function ($scope, $http, $localStorage, $state) { $scope.formData = []; $scope.processForm = function () { $http({ method: ‘post’, url: ‘process.php’, data: $.param($scope.formData), headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’} }) .success(function (result) […]

Next Page » « Previous Page