我正在尝试在Angular 4中创建自己的指令.但是,当将类的属性绑定到组件模板时,我得到了这个错误.
控制台错误:
Unhandled Promise rejection: Template parse errors: Can't bind to
'data' since it isn't a known property of 'tree'. ("<tree [ERROR
->][data]="data"></tree>"):
Run Code Online (Sandbox Code Playgroud)
我的tree-view-component.ts:
@Component({
selector: 'app-tree-view',
template: '<tree [data]="data"></tree>'
})
export class TreeViewComponent implements OnInit {
@Input() data: any[];
constructor() {
this.data = [
{
label: 'a1',
subs: [
{
label: 'a11',
subs: [
{
label: 'a111',
subs: [
{
label: 'a1111'
},
{
label: 'a1112'
}
]
},
{
label: 'a112'
}
]
},
{
label: 'a12', …
Run Code Online (Sandbox Code Playgroud) 我正在使用Keras和tensorflow后端构建CNN模型.我已经训练了模型6个小时.现在,我想使用我的模型预测我的自定义外部图像.如何在Keras做到这一点?谢谢
创建 WebSocketManagerExtensions 时出现错误,如下所示:
System.InvalidOperationException
A suitable constructor for type
'CustomerManagementCore.WebSocketManager.WebSocketManagerMiddleware' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
Run Code Online (Sandbox Code Playgroud)
MapWebSocketManager
方法:
public static IApplicationBuilder MapWebSocketManager(this IApplicationBuilder app,
PathString path,
WebSocketHandler handler)
{
return app.Map(path, (_app) => _app.UseMiddleware<WebSocketManagerMiddleware>(handler));
}
Run Code Online (Sandbox Code Playgroud)
WebSocketManagerMiddleware
构造函数:
public WebSocketManagerMiddleware(RequestDelegate next,
WebSocketHandler webSocketHandler)
{
_next = next;
_webSocketHandler = webSocketHandler;
}
Run Code Online (Sandbox Code Playgroud)
我知道我的WebSocketManagerMiddleware
构造函数是否有问题,但我不知道。有人知道吗?
谢谢。
我在 React Native 中使用react-navigation v2,每当想要返回根导航器中的特定选项卡时都会卡住。
我有以下路线堆栈:
const HomeStack = createStackNavigator(
{
Home: Home,
CreateInvoice: CreateInvoiceScreen,
InvoiceSummary: InvoiceSummaryScreen,
PinEntry: PinEntryScreen
},
{
navigationOptions: {
header: null
}
}
);
const CustomersStack = createStackNavigator(
{
Customers: CustomersScreen,
Details: CustomerDetailsScreen
},
{
navigationOptions: {
header: null
}
}
);
const Tab = createBottomTabNavigator(
{
Home: HomeStack,
Transactions: TransactionsTab,
Customers: CustomersStack,
Settings: SettingsTab
}
);
const Routers = createStackNavigator({
splash: {
screen: SplashScreen,
navigationOptions: {...navigationOptions}
},
login: {
screen: LoginScreen, …
Run Code Online (Sandbox Code Playgroud) 我使用.NET Core 3.0JsonDocument.Parse(ReadOnlyMemory<Byte>, JsonReaderOptions)
将WS消息()解析byte[]
为JSON,但它抛出一个异常,如下所示:
'0x00' is invalid after a single JSON value. Expected end of data. LineNumber: 0 | BytePositionInLine: 34.
Run Code Online (Sandbox Code Playgroud)
这是我的中间件片段代码:
WebSocket ws = await context.WebSockets.AcceptWebSocketAsync();
byte[] bytes = new byte[1024 * 4];
ArraySegment<byte> buffer = new ArraySegment<byte>(bytes);
while (ws.State == WebSocketState.Open)
{
try
{
WebSocketReceiveResult request = await ws.ReceiveAsync(bytes, CancellationToken.None);
switch (request.MessageType)
{
case WebSocketMessageType.Text:
string msg = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
json = new ReadOnlyMemory<byte>(bytes);
JsonDocument jsonDocument = JsonDocument.Parse(json);
break;
default:
break;
}
} …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 ASP.NET Core WebSocket,但new WebSocket("ws://localhost:5702");
在 JavaScript 中出现这样的错误:
WebSocket connection to 'ws://localhost:5702/' failed: Error during WebSocket handshake: Unexpected response code: 200
Run Code Online (Sandbox Code Playgroud)
我的配置方法Startup.cs
:
public void Configure(IApplicationBuilder app)
{
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseWebSockets();
app.UseWebSocketHandler();
}
Run Code Online (Sandbox Code Playgroud)
我的Middlewares\WebSocketMiddleware.cs
:
WebSocketMiddleware.cs
有人知道吗?
谢谢你。
我想制作一个浮动操作按钮来自动将 FlatList 滚动到底部。我的 FlatList 组件描述如下:
<FlatList
ref={(ref) => { this.flatListRef = ref; }}
contentContainerStyle={this.state.barangFiltered.length === 0 && { paddingTop: 10, justifyContent: 'center', alignItems: 'center' }}
showsVerticalScrollIndicator={false}
data={this.state.barangFiltered}
keyExtractor={(item, index) => `barang-${index}`}
renderItem={({ item, index }) => <Barang
item={item}
index={index}
navigation={this.props.navigation}
duplicateBarang={(item) => this._duplicateBarang(item)}
deleteBarang={(item) => this._deleteBarang(item)}
/>}
ListEmptyComponent={<Text style={{ fontSize: 16, fontWeight: '400' }}>List is empty</Text>}
getItemLayout={(data, index) => { return {length: 200, index, offset: 200 * index} }}
/>
Run Code Online (Sandbox Code Playgroud)
以及按钮组件:
<TouchableOpacity
activeOpacity={0.7}
style={styles.fab}
onPress={() => this.flatListRef.scrollToEnd()}
>
<Ionicons name="ios-add" …
Run Code Online (Sandbox Code Playgroud) c# ×3
javascript ×3
asp.net ×2
asp.net-core ×2
react-native ×2
reactjs ×2
.net ×1
android ×1
angular ×1
dnx ×1
dnx50 ×1
keras ×1
python ×1
tensorflow ×1
typescript ×1
websocket ×1