Tag: angularjs

在Mongoose更新查询期间,JavaScript对象元素缺失

我试图更新一个新的数据字段到一个现有的文件,但一些数据不更新。 在我的AngularJS控制器中: $scope.tellUsMore = function(){ var data = { businessPhone:$scope.usersData.phone, businessEmail:$scope.usersData.email, businessFb:$scope.usersData.fb, businessTwitter:$scope.usersData.twitter, businessInstagram:$scope.usersData.instagram, businessAboutUs:$scope.usersData.aboutUs, businessTags:$scope.tags, businessFeatures:$scope.features, businessLocation:$scope.usersData.location, businessPriceRange:$scope.usersData.priceRange, businessPreparationTimeRange:$scope.usersData.preparationTimeRange } console.log(data); //result below Account.updateProfile(data) .success(function() { alert("DONE") }) .error(function(error) { console.log(error) }); } 在Chrome控制台选项卡上的console.log(数据)结果 Object businessAboutUs: "LOL" businessEmail: "example@gmail.com" businessFb: undefined businessFeatures: Array[5] businessInstagram: undefined businessLocation: Object businessPhone: "0123456789" businessPreparationTimeRange: 2 businessPriceRange: 2 businessTags: […]

咕噜服务的问题

我有项目,但我不能运行他。 我使用WebStorm IDE,进入grunt服务器后,发现下面的错误: grunt serve Loading "connect.js" tasks…ERROR >> SyntaxError: C:\Users\TT\Documents\ES\frontend\node_modules\grunt-contrib-connect\node_modules\connect\node_modules\type-is\node_modules\mime-types\node_modules\mime-db\db.json: Unexpect ed end of input Loading "cssmin.js" tasks…ERROR >> Error: Cannot find module './source-map/source-map-generator' Loading "jshint.js" tasks…ERROR >> Error: Cannot find module 'jshint/src/cli' Loading "uglify.js" tasks…ERROR >> Error: Cannot find module 'pako/lib/zlib/messages' Loading "cdnify.js" tasks…ERROR >> SyntaxError: C:\Users\TT\Documents\ES\frontend\node_modules\grunt-google-cdn\node_modules\google-cdn\node_modules\cdnjs-cdn-data\external\cdnjs.json: Unexpected end of input Loading "inline_angular_templates.js" […]

Protractor JS不能在IE11上运行多合并testing

我想通过Protractor 2.0在Node.JS上运行Selenium的跨浏览器testing。 FF和Chrome的实例运行正常,只有IE11没有打开。 当我尝试了它,我得到错误如下: c:\automation\tests>protractor conf.js [launcher] Running 3 instances of WebDriver ———————————— [internet explorer #3] PID: 8904 [internet explorer #3] Specs: c:\automation\tests\message.js [internet explorer #3] [internet explorer #3] Using the selenium server at http://localhost:4444/wd/hub [internet explorer #3] ERROR – Unable to start a WebDriver session. [internet explorer #3] [internet explorer #3] C:\Users\idan\AppData\Roaming\npm\node_modules\protractor \node_modules\selenium-webdriver\lib\atoms\error.js:113 [internet […]

我如何开始使用MEAN.IO?

有没有什么好的资源可以开始使用MEAN.IO? 任何教程,待办事项应用程序或书籍? 等等。, 当然,我已经访问了包括mean.io , mean.js和一些平均堆栈教程的网站。 但事情有点混乱让我开始。 任何人都可以build议我,为了一个良好的起点mean.io. 提前致谢。,

使用angularjs / javascript将JSON对象传递给服务器

我怎样才能将前端(使用angularjs)的input字段的信息作为JSON对象传递给服务器(javascript)? 基本上我打算做的是从用户接收input,并将其作为查询传递以search数据库并返回值。 我的控制器代码: `app.controller('SearchController',['$scope','$http',function($scope,$http){ $scope.click=function(){ var data=$scope.query1; $http.post('/credjson',data); /*$scope.addRowAsyncAsJSON = function(){ $scope.cred.push({ 'query':$scope.query1 }); var dataObj = { query : $scope.query1, }; var res = $http.post('/credjson', dataObj); res.success(function(data, status, headers, config) { $scope.message = data; }); res.error(function(data, status, headers, config) { alert( "failure message: " + JSON.stringify({data: data})); }); $scope.query1='';*/` 注意:/ * * /之间的代码是不同的尝试。 我的查看代码: […]

AngularJS:AJAX返回是一个string,而不是一个对象

我有一个node.js服务器。 这个服务器有一个小的API。 我用AngularJS构build一个应用程序,我的问题是,如果我做了一个Ajax调用服务器,我得到一个string回来,而不是一个对象。 服务器API: exports.api = function(req, res, next) { var path = req.body.path var method = req.body.method digest.request({ host: 'xxx', path: path, port: 80, method: method, headers: { "User-Agent": "Bridge" } }, function (resX) { resX.on('data', function (data) { res.status(200).end(data) }) resX.on('error', function (err) { res.status(200).end(err) }) }) } 呼叫: .controller('TestCtrl', function($scope, $http) { […]

在控制器的angularjs中将parameter passing给资源工厂以在数据库中进行search

说明 我有一个文本框来select要显示的模型。 我需要将视图中的variables传递给angular色资源工厂,以传递给服务器控制器,以决定将哪个模型传递给客户端控制器。 正如你所看到的,我把一个名为issuename的variables传递给资源,然后我希望通过这个参数的大小select控制器中的模型。 我在文本框中键入牛仔裤,这意味着issuename应该等于牛仔裤,它应该给我相同的结果,因为当我手动分配searchParam的价值牛仔裤。 但它似乎没有正确传递,因为当我注释掉在服务器控制器中的行,我不能再看到牛仔裤模型。 我努力了: req.body.issuename req.params.issuename req.issuename 而且还不行,所以应该还有另外一个问题 在此先感谢您的帮助! 代码部分 客户服务($资源) angular.module('alls').factory('Alls', ['$resource', function($resource) { return $resource('alls/:issuename', {}, { get:{ method: 'GET', isArray:true } }); }]); 客户控制器 angular.module('alls').controller('AllsController', ['$scope', '$stateParams', '$location', 'Authentication', 'Alls', 'Jeans', function($scope, $stateParams, $location, Authentication, Alls, Jeans) { $scope.search = function(){ Alls.get({issuename: $scope.issueinput},function(response){ $scope.alls = response; }); }; }; […]

如何在angulars中的多个表单视图之间传递数据

我在angularjs中有一个多步骤的forms。 我使用ui-router在不同视图之间进行路由,ngResource用于将数据发送到mongodb。 我的问题是,我不能将表单的所有值直接发送到数据库,因为表单被拆分成多个视图。 当我用ng-submit提交表单时,只有那个视图的值被发送到数据库。 的index.html <body> <div ui-view></div> </body> 多个视图(register.html) <div class="row"> <div> <div id="form-container"> <div class="page-header"> <h2 class="text-center">Enter the following details</h2> <!– the links to our nested states using relative paths –> <!– add the active class if the state matches our ui-sref –> <div id="status-buttons" class="text-center link-colors"> <a ui-sref-active="active" ui-sref="/registration_form.signUp"><span>1</span> Setup</a> <a ui-sref-active="active" […]

什么是使用客户端路由的正确方法?

我有一个关于AngularJS和Node.js的问题。 我有一个Web应用程序,并使用routeProvider的客户端路由来浏览我的Web应用程序的页面。 我通过RESTful API服务器端获取数据。 但所有的逻辑都是在AngularJS中完成的,因为在客户端路由中,我在Node.js中所做的全部是: exports.partials = function(req, res, err) { var name = req.params.name; res.render(name); }; 所以,我只使用Node.js来渲染模板布局和局部视图,但是所有的逻辑都在AngularJS中。 这是使用它的正确方法吗?

对蒸汽市场的GET请求错误

我试图做一个GET请求来获取蒸汽市场上的单个项目的物品价格信息。 这里是我正在使用的确切的angularJS脚本: <script> var app = angular.module('csgo', []); app.controller('MainCtrl', function($scope, $http) { $http.jsonp("http://steamcommunity.com/market/priceoverview/?currency=3&appid=730&market_hash_name=StatTrak%E2%84%A2%20P250%20%7C%20Steel%20Disruption%20%28Factory%20New%29").success(function(response) { $scope.values = response; console.log(response); }); }); </script> 当我尝试在浏览器中执行此操作时,我得到: Uncaught SyntaxError: Unexpected token : ?currency=3&appid=730&market_hash_name=StatTrak™ P250 | Steel Disruption (Factory New):1 在我的Chrome浏览器控制台中。 然后点击错误信息中的链接(?currency = 3&appid = 730&market_hash_name = StatTrak™P250 | Steel Disruption(Factory New):1) 这需要我的一条线是: {"success":true,"lowest_price":"1,09€ ","volume":"348","median_price":"1,01€ "} 所以我实际上得到的信息,但它给出了一个错误,并强调红色的JSON响应。 有人知道这个问题吗? 我使用nodejs,express和angular。 编辑: 我尝试了一个不同的url: […]