有没有办法在angular2绑定中使用数学函数?
例
<div class="partition-panel">
<b class="pull-left">{{Math.round(variable/12*2)}}</b>
<b class="pull-right">{{Math.round(variable/12*2)}}</b>
</div>
Run Code Online (Sandbox Code Playgroud)
当试图使用这个我得到错误
Cannot read property 'round' of undefined
Run Code Online (Sandbox Code Playgroud)
对于angular1,也回答了类似的问题
我在Visual Studio 2015中创建了一个新的App(Xamarin.Forms Portable)项目.
当我尝试在Android的Visual Studio模拟器中运行Droid项目时,我只是得到一个通用的错误消息:
无法启动'VS Emulator 5"KitKat(4.4)XXHDPI Phone'设备.退出代码10
Logs消息是
06-Aug-15 1:42:39 PM: [Informational] Reinitializing installed profiles.
06-Aug-15 1:42:39 PM: [Informational] Installed profiles initialized. Devices: 2 Platforms: 1
06-Aug-15 1:42:42 PM: [Informational] Reinitializing installable profiles.
06-Aug-15 1:42:42 PM: [Informational] Installable profiles initialized. Devices: 30 Platforms: 4
06-Aug-15 1:42:46 PM: [Informational] Waiting to launch device...
06-Aug-15 1:42:46 PM: [Informational] Launching Device: 5" KitKat (4.4) XXHDPI Phone
06-Aug-15 1:42:46 PM: [Informational] Validating emulator arguments...
06-Aug-15 1:42:46 PM: [Informational] Determining if emulator …Run Code Online (Sandbox Code Playgroud) 我们在现有的asp.net c#MVC应用程序上放置一个有角度的前端.在我们的服务器代码中,我们可以使用自定义异常来返回商业规则错误.
有没有最好的做法或最简单的方法来处理mvc控制器或webApi控制器上的异常(实际上是从商务层跳出来)并将其转换为角度并在"用户错误"弹出窗口中显示它?人们如何解决这个问题?
如何使用typescript交换两个元素
elements:elements[] =[];
elements.push(item1);
elements.push(item2);
elements.push(item3);
elements.push(item4);
elements[0] is item1
elements[3] is item4
Run Code Online (Sandbox Code Playgroud)
我如何在打字稿中交换这些项目.我知道Javascript的方式,像这样:
*使用临时变量的javascript示例*
var tmp = elements[0];
elements[0] = elements[3];
elements[3] = tmp;
Run Code Online (Sandbox Code Playgroud)
但任何API中做同样的事情打字稿像
array.swap()
大家好
在这种情况下有许多线程可用...我尝试了一切,但没有运气.我是android背景的新手.我是c#家伙,现在iam与xamarin机器人合作......所以任何人都可以解释什么是错误.这个解决方案不起作用**PRE lolipop devices**.
我的布局
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/quickreturn_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/masonry_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
我是使用appcompact主题
值/ Style.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="Theme.Splash"
parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="AppTheme" parent="Base.Theme">
</style>
<style name="Base.Theme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/DarkOrangeLight</item>
<item name="colorPrimaryDark">@color/DarkOrange</item>
<item name="colorAccent">@color/DarkOrangeAcent</item>
<item name="windowActionBarOverlay">true</item>
<item name="android:windowBackground">@color/bg</item>
<item name="windowActionBar">false</item>
<item name="windowActionBarOverlay">false</item>
<item name="windowNoTitle">true</item>
<!-- Customize …Run Code Online (Sandbox Code Playgroud) 我正面临着WRAP_CONTENT无法工作RecyclerView,所以我用Google搜索并找到了解决方法.当我尝试在c#中实现变通方法时,我被困在这一行:
insetsDirtyField = RecyclerView.LayoutParams.class.getDeclaredField("mInsetsDirty");
Run Code Online (Sandbox Code Playgroud)
当我更新我的职场sdks.我正在警告这条线.
Palette.GenerateAsync(bitmap)
Run Code Online (Sandbox Code Playgroud)
方法Android.Support.Graphics.V7.Palette.Generate是不推荐使用的消息,因此这是生成调色板的最佳方法.
注意:
Java Code也很受欢迎
我有一些需要在整个应用程序中使用的自定义指令。如何注册我的指令以在整个应用程序中使用?我遇到的其他问题都已经过时了。我需要 Angular 2 最终版本 2.1.0 的解决方案
我的main.ts样子是这样的
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
//enableProdMode(); //Uncomment for production
platformBrowserDynamic().bootstrapModule(AppModule)
.then((success: any) => console.log('App bootstrapped'))
.catch((err: any) => console.error(err));
Run Code Online (Sandbox Code Playgroud)
我的应用程序有 6 个模块可以使用延迟加载
appmodule
--contact module
--project module
--restmodules
...
Run Code Online (Sandbox Code Playgroud)
当我在产品模块中注册该指令时,它运行良好。所以我在我的其余模块中使用了这个指令,我在其中注册了这个指令,appmodule.ts如下所示
import { mdinput} from './shared/mdinput.directive';
@NgModule({
imports: [
AppRoutingModule
],
declarations: [
AppComponent,mdinput
],
providers: [DataService],
bootstrap: [AppComponent]
})
export class AppModule {
}
Run Code Online (Sandbox Code Playgroud)
现在这个特定指令不起作用。它也没有给出任何错误。
c# ×4
android ×3
angular ×3
typescript ×3
angularjs ×1
asp.net-mvc ×1
java ×1
javascript ×1
reflection ×1