Tag: angularjs

方式发送标题键与angular度得到/张贴expression4 rest api

我正在使用基本身份validation标头来确保我们的服务。 该服务在正常工作的其他客户端进行testing。 现在我们要从UI部分发送密钥。 但是我们无法使用get和post调用来发送标题值。 //包含头authentication密钥的JSONvariables。 var authorizationHeader = { headers: {'Authorization': 'Basic xxxxxxxxxxxxxx'} }; //用于发送请求并接收值的控制器。 app.controller("UserAuth",function($scope,$http){ $http.get(getAuthorization,authorizationHeader).success(function(data) { var data=data; }): }); 在rest的API,我们收到的标题为: var headervalue=req.headers.Authorization; 但我们收到undefined的值。 请确定我的错误。

用Angularjs上传图片

当我在模块中添加“ngFileUpload”时出现错误。 我用过 var app = angular.module('myApp', ['ngFileUpload']); 并在路由页面: angular.module('myApp') .config(function ($stateProvider) { $stateProvider .state('dashboard', { url: '/dashboard', templateUrl: 'app/dashboard/dashboard.html', controller: 'DashboardCtrl' }) }); 错误是: Error: [$injector:modulerr] Failed to instantiate module umxApp due to: [$injector:unpr] Unknown provider: $stateProvider http://errors.angularjs.org/1.4.1/$injector/unpr?p0=%24stateProvider minErr/<@http://localhost:9000/bower_components/angular/angular.js:68:12 createInjector/providerCache.$injector<@http://localhost:9000/bower_components/angular/angular.js:4255:19 getService@http://localhost:9000/bower_components/angular/angular.js:4402:39 invoke@http://localhost:9000/bower_components/angular/angular.js:4434:1 runInvokeQueue@http://localhost:9000/bower_components/angular/angular.js:4349:11 loadModules/<@http://localhost:9000/bower_components/angular/angular.js:4358:11 forEach@http://localhost:9000/bower_components/angular/angular.js:336:11 loadModules@http://localhost:9000/bower_components/angular/angular.js:4339:5 createInjector@http://localhost:9000/bower_components/angular/angular.js:4265:11 bootstrap/doBootstrap@http://localhost:9000/bower_components/angular/angular.js:1621:20 bootstrap@http://localhost:9000/bower_components/angular/angular.js:1642:1 angularInit@http://localhost:9000/bower_components/angular/angular.js:1536:5 @http://localhost:9000/bower_components/angular/angular.js:28289:5 jQuery.Callbacks/fire@http://localhost:9000/bower_components/jquery/dist/jquery.js:3099:10 jQuery.Callbacks/self.fireWith@http://localhost:9000/bower_components/jquery/dist/jquery.js:3211:7 .ready@http://localhost:9000/bower_components/jquery/dist/jquery.js:3417:1 completed@http://localhost:9000/bower_components/jquery/dist/jquery.js:3433:2 […]

从NODE服务器向支付网关发送POST请求

在我目前对MEAN堆栈的启发下,对于select在线支付的客户,我已经创build了一个这样的超链接。 <div> <a class="btn btn-pram-primary btn-block" href="node/public/orders">Online Payment</a> </div> 我用节点代码拦截这个url。 var sendRequestToPayU = function( req, res, next ) { console.log('In sendRequestToPayU' ); var post_data = querystring.stringify({ 'txnid': '1', 'amount': '100', 'productinfo' : 'ABCD', 'firstname' : 'UserName', 'email' : 'user@user.com', 'phone' : '9876543210' }); request({ url: 'https://test.payu.in/_payment', //URL to hit method: 'POST', headers: { 'Content-Type': 'MyContentType', […]

NodeJS代理不按预期工作

请求的当前路由来自localhost:3001,通过在localhost:3001 / proxy上的同一本地主机上运行的代理,然后将请求路由到Salesforce实例。 代理使用ExpressJS进行,客户端应用使用AngularJS。 注意:我确实记得在我的密码末尾(Salesforce API要求)标记了我的安全令牌,虽然在使用cURL时似乎没有必要。 这里有一系列的HTTP跟踪,希望能够提供一些线索: 来自Angular.JS App的HTTP请求日志: POST /proxy HTTP/1.1 Host: localhost:3001 Connection: keep-alive Content-Length: 234 Pragma: no-cache Cache-Control: no-cache X-User-Agent: salesforce-toolkit-rest-javascript/v29.0 Origin: http://localhost:3001 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36 Content-Type: application/x-www-form-urlencoded Accept: application/json, text/plain, */* SalesforceProxy-Endpoint: https://uniquename.salesforce.com/services/oauth2/token Referer: http://localhost:3001/ Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8 Cookie: liveagent_oref=; […]

我想访问一个JS文件中提供的enTranslations如下所示,但我不能够访问它

正如你可以看到我的HTML我想根据我的当前区域设置我的数据,我有自定义翻译文件enTranslation,这是给出的。 问题: 当我使用{{ translations[key] }}或{{ translation.key }}时,我无法在浏览器页面上看到这些值 请帮助我了解做这项工作需要做些什么。 我有js目录中的3个文件,下面给出的代码: enTranslations.js prax_controller.js angular_1.4.2.min.js 我的HTML文件 <!DOCTYPE html> <html> <head> <script src="js/angular_1.4.2.min.js"></script> <script src="js/prax_controller.js"></script> <script src="js/enTranslations.js"></script> <meta charset="UTF-8"> <title>Prax Local</title> </head> <body ng-app="prxApp" ng-controller="prxController"> <div> List <ul class="d1" ng-repeat="(key, value) in eventHistories"> <li class="d1k"> <!– {{ translations.key }}: {{ value }}% –> {{ translations[key] }} : {{ value […]

在mac中安装node.js和npm时遇到困难

我正在尝试在Mac mini中安装node.js和npm。 我经历了很多教程。 有时它正在安装,无法使用它。 现在我正在安装使用Homebrew。 nbmacmini9:~ afsarunnisa$ brew install node ==> Downloading https://homebrew.bintray.com/bottles/node-0.12.7.yosemite.bottle ######################################################################## 100.0% ==> Pouring node-0.12.7.yosemite.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink share/man/man1/node.1 Target /usr/local/share/man/man1/node.1 already exists. You may want to remove it: rm '/usr/local/share/man/man1/node.1' To force the […]

不知道如何使用meanjs限制路线

我是相当新的平均堆栈…目前我正在build设的应用程序,我用meanjs和yeoman脚手架出来。 我想要用户,我希望pipe理员pipe理这些用户(创build/删除用户,添加其他pipe理员)。 meanjs构build的方式是: roles: { type: [{ type: String, enum: ['user', 'admin'] }], default: ['user'] 我在数组中添加了“admin”。 这是处理这个问题的好方法还是有更安全的方法? 我面临的主要问题是我无法弄清楚如何确保只有pipe理员的某些路线。 我知道这可以做angular度和快递/节点,但我不知道如何实现。 我已经使用Googlesearch了3天,并且遇到了从头开始构build的人(看起来没有像我当前的代码或文件夹结构),或者没有执行任何types的路由限制/授权/身份validation。 我也看了一下这个文档,根本没有帮助。 任何build议,帮助,学习的地方将不胜感激。

Angular JS Express JS File Upload抛出错误,undefined不是函数

这是我在控制台上得到的错误 TypeError: undefined is not a function at C:\nodefiles\new\server.js:101:16 at Layer.handle [as handle_request] (C:\nodefiles\new\node_modules\express\lib\router\layer.js:95:5) at next (C:\nodefiles\new\node_modules\express\lib\router\route.js:131:13) at done (C:\nodefiles\new\node_modules\multer\lib\make-middleware.js:36:7) at indicateDone (C:\nodefiles\new\node_modules\multer\lib\make-middleware.js:40:51) at C:\nodefiles\new\node_modules\multer\lib\make-middleware.js:142:11 at WriteStream.<anonymous> (C:\nodefiles\new\node_modules\multer\storage\disk.js:43:9) at WriteStream.emit (events.js:129:20) at finishMaybe (_stream_writable.js:484:14) at afterWrite (_stream_writable.js:362:3) at onwrite (_stream_writable.js:352:7) at WritableState.onwrite (_stream_writable.js:105:5) at fs.js:1799:5 at FSReqWrap.strWrapper (fs.js:568:5) 这是我的HTML页面 <!doctype html> <html> <head> <meta charset="utf-8"> […]

如何在基于angular-fullstack的应用程序中包含库文件(css / js)

我使用了一个Yo Angular-Fullstack生成器( https://github.com/DaftMonk/generator-angular-fullstack ),并启动了一个应用程序,然后尝试从凉亭通过做安装Toastr – bower install angular-toastr 现在我想添加toastr css和js文件。 他们位于 bower_components/angular-toastr/dist 现在我如何将它们包含在当前项目中,以便在使用grunt构build应用程序时将它们包含在dist文件夹中。 文件夹结构如下 – ├── client │ ├── app – All of our app specific components go in here │ ├── assets – Custom assets: fonts, images, etc… │ ├── components – Our reusable components, non-specific to to our app │ ├── e2e – […]

如何configuration标签的语法标记

我目前正在使用ejs模板sails.js,但希望切换到nunjucks。 我已经完成了这个没有问题。 但是,我发现nunjucks的标签和angularjs的标签一样,并希望改变它们。 我看这里的文档: https : //mozilla.github.io/nunjucks/api.html#customizing-syntax 我不知道如何在sails.js的情况下做到这一点。 我已经尝试添加一个'标签'设置config / view.js。 我试过在bootstrap.js中运行configure命令。 有谁能帮我解决这个问题吗?