在提出这个问题之前,我已经提到了以下但没有帮助我
有些帖子说要使用passport-facebook-token但是我不想使用,因为我想扩展我的应用程序的现有功能只有passport-facebook
问题陈述
目前,我使用passport-facebook进行身份验证,效果很好.现在我想扩展功能,使用Facebook Graph API来获取登录我的应用程序的用户的照片
因此,使用Facebook Graph API在Node JS中使用请求模块获取我必须在下面调用的用户照片,正文部分将返回给我预期的结果
var request = require("request");
var options = {
method: 'GET',
url: 'https://graph.facebook.com/me/photos/',
qs: {
access_token: 'EBBCEdEose0cBADwb5mOEGISFzPwrsUCrXwRWhO87aXB9KsVJlgSLc19IdX9D9AKU7OD5SdFOqPXW3eLm8J3HltZC14VexdMsEDW35LDWASdVDNGp5brFERBETsIvxXJIFXo7QSum5apHXeRyQk7c2PQljmf5WHObZAwXVzYjqPd4lziKTUK48Wfrw5HPwZD'
},
headers: {
'content-type': 'application/json'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Run Code Online (Sandbox Code Playgroud)
但是现在我想创建我的自定义快速GET API,当我调用我应该得到上面的身体响应,
喜欢 GET : /graph/photos
app.get('/graph/photos', function (req, res) {
res.send(body)//Here I wanted to get the same response as of …Run Code Online (Sandbox Code Playgroud) facebook node.js facebook-graph-api passport-facebook passport.js
目前我正面临node_modules中的一个模块的问题,而r编译Angular 4项目并得到如下错误因此我决定在tsconfig.json中排除这个项目,但我仍然得到错误,有人可以帮我吗这里
ERROR in D:/workspace/demo/node_modules/@types/d3-collection/index.d.ts (148,23): ',' expected.
ERROR in D:/workspace/demo/node_modules/@types/d3-collection/index.d.ts (483,40): ',' expected.
ERROR in D:/workspace/demo/node_modules/@types/d3-collection/index.d.ts (148,25): Type parameter name cannot be 'any'
Run Code Online (Sandbox Code Playgroud)
因此我决定排除node_modules以避免这些错误,但在运行时我仍面临同样的错误 npm start
tsconfig.json
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es6",
"dom"
],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
},
"exclude": [
"**/node_modules/*"
]
}
Run Code Online (Sandbox Code Playgroud) 我有以下基本Javascript来反转我使用时工作的数字
while (!no == 0)
但是当我使用时不起作用
while (!no === 0)
我已经尝试在控制台中只parseInt(0)返回,number而我no已经是number这样
为什么
===不工作,有人可以帮助并更好地解释我吗?
function findRepeated(number) {
var a, no, b, temp = 0;
no = parseInt(number);
while (!no == 0) {
a = no % 10;
no = parseInt(no / 10);
temp = temp * 10 + a;
}
return temp;
}
console.log(findRepeated(123));Run Code Online (Sandbox Code Playgroud)
我开发了 Angular 8 应用程序,我正在使用 routerLink 来导航组件,这些组件工作正常,没有任何问题,但是当我直接在浏览器中输入相同的 URL 时,它没有显示任何内容,并且在控制台中,我看到了错误如下
例如,我打开主页http://localhost:4200/home并在此处添加了 routerLink 以转到http://localhost:4200/about并且我将能够成功查看但如果我输入 URL http ://localhost:4200/about直接在 ULR 里什么都没有显示
我已经处理了 app-routing.model.ts
const routes: Routes =
[
{ path: 'home', component: HomeComponent },
{ path: 'about', component: AboutComponent },
{ path: '**', redirectTo: '/home', pathMatch: 'full' }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
Run Code Online (Sandbox Code Playgroud)
我有 header.component.ts 来处理导航栏,所以我
<router-outlet></router-outlet>在 header.component.html 中添加了<app-header></app-header>,然后在app.component.ts 中包含了 header.component.ts 的选择器,然后在最后的index.js 中包含了 header.component.ts 的选择器
。 html 我已经包含了 app.component.ts 的选择器,即<app-root></app-root>
你能告诉我是否有问题。
在问这个问题之前,我已经经历了下面的一切,没有任何帮助
任何人都可以帮助我获得以下错误的解决方案.
以下是要配置的组件的版本
执行命令
mvn -fn -e org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar -Dsonar.jdbc.url="jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" -Dsonar.host.url=http://localhost:9000 -DskipTests
Run Code Online (Sandbox Code Playgroud)
在控制台窗口中我收到错误
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:
3.2:sonar (default-cli) on project NWT_Core: Execution default-cli of goal org.s
onarsource.scanner.maven:sonar-maven-plugin:3.2:sonar failed: Unable to load the
mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-plugin:3.
2' due to an API incompatibility: org.codehaus.plexus.component.repository.excep
tion.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo : Unsupported major.minor version 52.0
Run Code Online (Sandbox Code Playgroud) 我是RxJ观察站的新手,一旦满足条件,我将难以取消订阅循环,请您帮我一下
在下面的函数中,如果代码到达if块,我想退订Observables
在问这个问题之前,我先经历了以下问题,但没有一个对我有太大帮助
Javascript功能
this.router.events.subscribe((url: any) => {
url = this.router.url;
if ((url === "/profile" || url === "/summary") && this.filterConfigFlag === false) {
/*
Perform operations
*/
} else {
console.log(typeof (url), url);
}
});
Run Code Online (Sandbox Code Playgroud) 任何人都可以帮我解决下面的问题,目前我正在使用下面的代码来显示我使用这两个<td>标签导出条件值的值,有什么办法可以在一个<td>标签中做其他的吗?
<td class="features" ng-if="OrderStatus.length>0">
<span ng-repeat="indi in ServiceDisconnects.Service">{{indi.serviceID}}<br></span>
</td>
<td class="features" ng-if="!OrderStatus.length>0">
<span ng-repeat="indi in ServiceDisconnects.Service">{{indi.productID}}<br></span>
</td>
Run Code Online (Sandbox Code Playgroud) orderBy 功能不适用于我尝试使用的日期 ng-repeat
在这里,我想对基于的托管进行排序 executedOn
我想排序元素,最新日期应该反映在顶部.
有人能帮我吗
var app = angular.module('myApp', []);
app.controller('MainCtrl', function($scope) {
$scope.details = [
{
"id": 255463,
"orderId": 226433,
"status": 1,
"executedOn": "25/Sep/17",
"executedBy": "Person A",
"executedByDisplay": "Person A",
"cycleId": 4042,
"cycleName": "Cycle A",
"versionId": 21289,
"versionName": "Version A",
"issueKey": "A"
},
{
"id": 255433,
"orderId": 226403,
"status": 1,
"executedOn": "1/Mar/17",
"executedBy": "Person B",
"executedByDisplay": "Person B",
"cycleId": 4041,
"cycleName": "Cycle B",
"versionId": 21289,
"versionName": "Version A",
"issueKey": "B"
},
{
"id": 255432,
"orderId": 226402,
"status": …Run Code Online (Sandbox Code Playgroud)我在使用Angular 5服务时面临以下问题,请您帮我解决下面的代码有什么问题
我已经解决了以下问题,但没有帮助我
我只想初始化类中的值并在方法中使用它
虽然我已经在类中定义的URL值我得到误差Cannot read property 'url' of undefined为线console.log(this.url);
@Injectable()
export class OwnService {
public accessTokenvalue = '';
public url = 'https://www.someurl.com/id=';
constructor(private hp: HelpService) {
}
public gethpPhotos() {
this.hp.login()
.then(function (response: LoginResponse) {
console.log(response);
console.log(this.url);
})
.catch((error: any) => console.error(error));
}
}
Run Code Online (Sandbox Code Playgroud) 我在 PHP 中创建了帖子表单,单击按钮就会下载一个 excel 文件,并且我还有一些表单数据也发布到 URL 和文件,用于使用纯 HTML 成功下载并提交表单
在 PHP 中,这是当表单发布到文件时触发的函数
public function downloadExcel($fileName = '', $addTimeStamp = true) {
$fileName = (!$fileName) ? 'excel_download' : preg_replace('/\s+/', '_', $fileName);
if ($addTimeStamp) {
$fileName .= date('_d_m_Y_H_i_s');
}
$fileName .= '.xlsx';
$this->setActiveSheetIndex(0);
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="' . $fileName . '"');
header('Cache-Control: max-age=0');
header('Cache-Control: max-age=1');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: cache, must-revalidate');
header('Pragma: public');
$objWriter = PHPExcel_IOFactory::createWriter($this, 'Excel2007'); …Run Code Online (Sandbox Code Playgroud) 有人可以帮助我,如何在innerHTML 标签中使用ng-template,
Stackblitz 演示:https ://stackblitz.com/edit/angular-xgnnj4
我想做的是,
在组件 HTML 中
<div [innerHTML]="htmlString"><div>
Run Code Online (Sandbox Code Playgroud)
在组件 TS
@ViewChild('dynamicComponent', { static: false, read: ViewContainerRef }) myRef: ViewContainerRef;
htmlString = `<ng-template #dynamicComponent></ng-template>`;
ngAfterViewInit(): void {
const factory = this.componentFactoryResolver.resolveComponentFactory(CommentComponent);
const ref = this.myRef.createComponent(factory);
ref.changeDetectorRef.detectChanges();
}
Run Code Online (Sandbox Code Playgroud)
我真的需要以这种方式实现,因为我想从 API 获取 HTML 内容并使用该值动态显示 HTML 内容
当我收到错误时无法读取未定义的属性“createComponent”,但如果我将其放在innerHTML 之外,它可以完美运行
我已经浏览了https://angular.io/guide/dynamic-component-loader但它对我的场景没有帮助
innerhtml angular2-template ng-template angular angular-dynamic-components
打印绝对排序数组。请参阅示例输出以进行澄清。
输入:
9 -2 10 3 -5 34 -22 7
Run Code Online (Sandbox Code Playgroud)
我想要输出:
-2 3 -5 7 9 10 -22 34
Run Code Online (Sandbox Code Playgroud)
我尝试过 Arrays.sort(a[]);
请帮助我:
谢谢
angular ×6
angularjs ×2
javascript ×2
typescript ×2
angular5 ×1
download ×1
facebook ×1
innerhtml ×1
java ×1
ng-template ×1
node.js ×1
npm ×1
observable ×1
passport.js ×1
php ×1
phpexcel ×1
routelink ×1
rxjs ×1
sonar-runner ×1
sonarqube ×1
tsconfig ×1