Search Posts

Category: mean

Refused to load the font ‘<URL>’ because it violates the following Content Security Policy directive default-src ,so default-src is used as a fallback

I am creating a web app using the mean stack in angular 6 but I am getting below error message on the browser console. “Refused to load the font ‘<URL>’ because it violates the following Content Security Policy directive: “default-src ‘self’”. Note that ‘font-src’ was not explicitly set, so ‘default-src’ is used as a fallback.” Code: getUsers() { return this._http.get(“/api/users”) .pipe(map(result => this.result = result.json().data)); } Source: AngularJS

Response for preflight is invalid (redirect), cross-origin requests are being blocked [duplicate]

This question already has an answer here: XMLHttpRequest cannot load https://www.[website].com/ 6 answers How to enable CORS in AngularJs 6 answers I need to consult some zip codes in the viacep API (, when I execute the get below: vm.buscarCEP = function(){ const cep = vm.empresaResponsavel.cep //RECEBE CEP DO CAMPO const apiViaCep = `${cep}/json/` $http.get(apiViaCep).then(function(resp) { //CONSULTA NA API vm.empresaResponsavel.logradouro = vm.empresaResponsavel.bairro = vm.empresaResponsavel.cidade = vm.empresaResponsavel.uf = }).catch(function(resp) { console.log( console.log(“CEP […]

opening up https proxy port on google cloud platform

I’m building a simple web app (MEAN) and deploying to GCP (Google Cloud Platform) I have built an application where my client runs on 4200 and the server runs on port 3000. I have two choices, combine my client and server to run on the same port, or simply allow the connection between 4200 and 3000. Currently I get an error trying to proxy requests between thees two ports. Any ideas how I open 3000 […]

Fails to install the Angular CLI in Ubuntu 16.04

I can not install the angular cli in ubuntu 16.04. After entering the sudo npm install-g angular-cli, it takes a long time to load and write. npm ERR! Linux 4.13.0-37-generic npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g” “angular-cli” npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! path /usr/local/bin/ng npm ERR! code EEXIST npm ERR! Refusing to delete /usr/local/bin/ng: ../lib/node_modules/@angular/cli/bin/ng symlink target is not controlled by npm /usr/local npm ERR! File exists: /usr/local/bin/ng npm […]

load mongo information to my own front-end table

how to load mongo information to my own front-end table I create my table with angular but whem i try i put the information here doesn’t appear and i don’t know why doesn’t have errors but the information but i can see the information and i read the information and the information appear. I put my code down with hope to some one can help me PD: sorry for my bad english. 😀 student-service.ts @Injectable() […]

How to use fileReader in angular js [duplicate]

This question already has an answer here: File Upload using AngularJS 26 answers ng-model for <input type=“file”/> 11 answers I have a function only for up function uploadBlogIamge(blogUrl, data, successMsg, errorMsg) { delete data.images; var file = document.querySelector(‘input[type=file]’).files[0]; var reader = new FileReader(); if (file) { data.imageName = reader.readAsDataURL(file); } Upload.upload({ url: $rootScope.server_url + blogUrl, //webAPI exposed to upload the file arrayKey: ”, data: data //pass file as data, should be user ng-model }).then(function (resp) […]

How to change the data in script tags in html from js?

I have the following script tag in my html, <script type=”application/ld+json”> { “@context”: “”, “@type”: “VideoObject”, “name”: “Title”, “description”: “Video description”, “thumbnailUrl”: [ “ .png” ], “uploadDate”: “2015-02-05T08:00:00+08:00”, “duration”: “PT1M51S”, “embedUrl”: “”, “interactionCount”: “2347” } </script> I want to append values to this through my js file,like “name”: “My Title”, “description”: “My description” But i dont know how to assign values to the script tag form js.I am using angular js.Can anyone please suggest me […]

Next Page »