Cannot find control with name:

Issue I have a quite complicated form which I want to break down into individual components. Here is my base form (only taken example fields), I’m using FormBuilder: ngOnInit() { this.predictorQuestion = this.fb.group({ question: [”, Validators.required], options: this.fb.array([ this.fb.control(”, Validators.required),

Continue reading

jade outputs relative links

Issue I’m starting to play with node, express and jade and when I do this a(href=”http:/www.example.com/” + variable) variable I get a relative link, say <a href=”http://127.0.0.1:3000/www.example.com/mytext”>mytext</a> Instead of the absolute link. I’m guessing I’m doing something wrong with the

Continue reading

Optimize Jade Wrapper

Issue I’m looking to print a div drawn from a series of objects. I can achieve this by using the pipe syntax below. each i, key in faq if (key == 0) | <div class=”list-group dropdown”> | <h6 class=”list-title” data-toggle=”dropdown”>

Continue reading

convert string to ISO date time in nodejs

Issue Convert this date into ISO format in nodejs created_at=”September 17th 2019, 16:50:17.000″; let new_time = new Date(created_at); created_at = new_time.toISOString(); console.log(created_at); Output: Invalid Date Exacting output is in ISO format. like this 2011-10-05T14:48:00.000Z Solution Moment.js is a library which

Continue reading

Format footer values in ui-grid

Issue How do I format the aggregate value for a column in ui-grid? With my numbers I get something horrible like total: 6370.046074130321 when I would like total: $6370.05 I tried both: footerCellTemplate: ‘<div class=”ui-grid-cell-contents” >{{COL_FIELD | currency}}</div>’, and footerCellTemplate:

Continue reading

How to read data in express js from form data

Issue Here is request payload I can see in console ——WebKitFormBoundaryW5j4rbM04jMUgOkU Content-Disposition: form-data; name="file"; filename="Screenshot from 2016-12-12 18-34-26.png" Content-Type: image/png ——WebKitFormBoundaryW5j4rbM04jMUgOkU Content-Disposition: form-data; name="userId" 12 ——WebKitFormBoundaryW5j4rbM04jMUgOkU Content-Disposition: form-data; name="isAdmin" true ——WebKitFormBoundaryW5j4rbM04jMUgOkU– I need to read userId which is there name="userId"

Continue reading

Issue with angularJS npm packages and dependencies

Issue This is the error I get angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.4/$injector/modulerr?p0=myApp&p1=Error%3A%2…arJS%2Fangular-my-app%2Fnode_modules%2Fangular%2Fangular.min.js%3A22%3A179) at angular.js:38 at angular.js:4920 at q (angular.js:403) at g (angular.js:4880) at eb (angular.js:4802) at c (angular.js:1914) at Sc (angular.js:1935) at ue (angular.js:1820) at angular.js:33367 at HTMLDocument.b (angular.js:3431) This

Continue reading

Weird scope behavior in node or am I sleeping?

Issue My js is as follows, /* * GET home page. */ var MongoClient = require(‘mongodb’); exports.index = function(req, res){ var studentObj = {}; MongoClient.connect(“mongodb://localhost:27017/MY_DB_TEST”, function(err, db) { if(!err) { console.log(“We are connected”); var collection = db.collection(‘test’); var stream =

Continue reading

Lexical scoping in ES6 / Node

Issue I’m attempting to understand ES6 lexical scoping (using the node runtime). Consider the following: ‘use strict’; let x = 10; function f() { console.log(x); console.log(y); // This should crash } let y = 5; f(); Paraphrasing from the O’Reilly

Continue reading

Pass a block variable to a callback function that has already arguments

Issue This is my callback: function evaluateServiceResponse(err, response){ db.answerCollection.insert({id: response[“serviceAnswer”][“id”]}); //problem is this line } This is my callback-user: mysoapclient.invokeServiceMethod(jsonRecords,this.evaluateServiceResponse); Here is the whole code. Inside process I create a block reference to my database: process(function(){ … let db=null; db

Continue reading

JavaScript Class Weird Scoping

Issue Assuming I have two files. One file with a class where the method hello just console.logs this: // Class.js class Test { constructor() { this.inside = true; } hello() { console.log(‘inside hello’) console.log(this); } } module.exports = new Test();

Continue reading

Bind scoping javascript

Issue I’m trying to figure out scoping of using bind. I’m confused about the output of boundF1. What is going on here? // console.log(x) ReferenceError: x is not defined // setting this.x – this here is global or window this.x

Continue reading

Node.js Access Values from Anonymous function

Issue Good morning! I’ve been struggling to get a specific value returned from my function: const getFolders = function (PID){ var token = getStoredToken() request.get({ url: ‘https://api.procore.com/vapid/folders’, headers: { Authorization: “Bearer ” + token.access_token }, json: { company_id: ‘12594’, project_id:

Continue reading

Angular Routing with ngRoute doesn't work for some routes

Issue In my single page application I have used ngRoute for angular routing. But I am facing some problems for angular routing. configuration : app.config(function($routeProvider,$locationProvider){ $locationProvider.html5Mode(true); $locationProvider.hashPrefix(‘!’); $routeProvider .when(‘/product’,{ templateUrl : ‘views/product/template/product.html’, controller : ‘productCtrl’ }) .when(‘/product/add’,{ templateUrl : ‘views/product/template/add-product.html’,

Continue reading