我正在学习Angular 2,我使用RC7遇到了这个问题.
app.routing.ts:
import { ModuleWithProviders, NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { LoginRoutes } from './login/index';
import { DashboardRoutes } from './dashboard/index';
const routes: Routes = [
...LoginRoutes,
...DashboardRoutes
//{ path:'', component: GridViewComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
providers: []
})
export class Ng2PlayRoutingModule { }
Run Code Online (Sandbox Code Playgroud)
login.routes.ts
import { LoginComponent } from './index';
export const LoginRoutes = [
{
path: 'login',
component: LoginComponent
},
{ …Run Code Online (Sandbox Code Playgroud) 我开发松弛僵尸。我正在实现通知功能,它将每隔一小时发送一次通知。目前,我正在发送普通文本通知,但是我需要将图像与文本一起发送。是否有可能发送图像?
我是Angular 2的新手,正在尝试使用scroll事件进行rest调用。我有200条记录,最初我会像这样打个电话
localhost:8080/myapp/records=items&offset=0&limit=50
Run Code Online (Sandbox Code Playgroud)
它将首先获取50条记录。但是,当我向下滚动时,它必须进行另一个API调用来获取另外50条记录,例如
localhost:8080/myapp/records=items&offset=50&limit=50
Run Code Online (Sandbox Code Playgroud)
我尝试了此操作,但未触发事件。
的HTML
<div>
<table class="doc-table" (scrolled)="onScroll($event.value)">
<thead>
<th class="avatar-th"></th>
<th>Id</th>
<th>Name</th>
<th>Price</th>
</thead>
<tbody>
<tr *ngFor="let item of items" (click)="routeTo(item.id)">
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.price}}</td>
</tr>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
脚本
@Component({
selector: 'item-cmp',
templateUrl: 'items.component.html'
})
export class PatientsComponent(){
onScroll(event:any){
alert("Scolled...");
}
}
Run Code Online (Sandbox Code Playgroud)
基于偏移量,我必须进行API调用。帮帮我,该怎么做?
我正在尝试使用 slack api https://api.slack.com/methods/channels.join创建一个新频道,但收到此响应
info: ** API CALL: https://slack.com/api/channels.join
Response : { ok: false, error: 'user_is_bot' }
Run Code Online (Sandbox Code Playgroud)
我试过这个
controller.hears('hello', ['direct_message', 'direct_mention', 'mention'], function (bot, message) {
bot.api.channels.join({'name':'nag'}, function (err, response) {
console.log("Response : ",response);
})
});
Run Code Online (Sandbox Code Playgroud)
如果我弄错了,请告诉我。我已经开始学习 slack api。