我觉得我错过了什么.当我尝试data
attribute
在我的中使用时template
,像这样:
<ol class="viewer-nav">
<li *ngFor="#section of sections" data-value="{{ section.value }}">
{{ section.text }}
</li>
</ol>
Run Code Online (Sandbox Code Playgroud)
Angular 2
崩溃:
EXCEPTION:模板解析错误:无法绑定到"sectionvalue",因为它不是已知的本机属性("
] data-sectionvalue ="{{section.value}}"> {{section.text}}
我显然遗漏了一些语法,请帮忙.
我想尝试以下工作:
_dbmsParentSections = FactoryTools.Factory.PdfSections
.Include(x => x.Children.OrderBy(y => y.Order).ToList())
.Include(x => x.Hint).Include(x => x.Fields)
.Where(x => x.FormId == FormId && x.Parent == null)
.OrderBy(o => o.Order)
.ToList();
Run Code Online (Sandbox Code Playgroud)
导致异常的部分是:
.Include(x => x.Children.OrderBy(y => y.Order).ToList())
Run Code Online (Sandbox Code Playgroud)
编辑:
经过进一步观察,
_dbmsParentSections.ForEach(x => x.Children = x.Children.OrderBy(y => y.Order).ToList());
Run Code Online (Sandbox Code Playgroud)
为我完成了这项工作(在初次Factory
通话之后没有Children.OrderBy
).
我的组件以这种方式定义:
import { Component } from 'angular2/core'
@Component({
selector: 'sidebar',
templateUrl: 'js/app/views/sidebar.html',
})
export class SidebarComponent {
public sections: boolean[] = [
true,
false,
false,
false,
false,
false,
false,
false
];
}
Run Code Online (Sandbox Code Playgroud)
该sidebar.html
模板:
<h3 class="proofTitle">...</h3>
<p [hidden]="sections[0]">
...
</p>
<p [hidden]="sections[1]">
...
</p>
...
<p [hidden]="sections[7]">
...
</p>
Run Code Online (Sandbox Code Playgroud)
看起来非常直接,但出于某种原因,它显示了所有部分......我错过了什么?
如何与集成PayPal API
在一个ASP.NET Core
应用程序?我尝试了各种库,但没有一个与ASP.NET Core
... 兼容......我该怎么做?
我试图让Angular 2
在工作Visual Studio 2015
与Typescript
.我想尝试在MVC 5
类型Web项目(web.config
而不是config.json
)中使用最基本的示例:
import {Component, bootstrap} from 'angular2/angular2';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
class AppComponent { }
bootstrap(AppComponent);
Run Code Online (Sandbox Code Playgroud)
我正在尝试使这项工作所需的最小的东西.所以我下载了最新的Angular 2(alpha .45)并复制了TypeScript
下载modules
文件夹中的所有内容.包括所有子文件夹(减去了docs
和examples
人.)
我确信这将在Visual Studio
我之前完成之前工作,但是我试图让它工作Visual Studio
,它给了我超过3,000个错误,看起来是因为我错过了其他模块或其他东西.
以下是我遗漏的几件事:
地图(default_keyvalue_differ.ts
和许多其他人):
export class DefaultKeyValueDiffer implements KeyValueDiffer {
private _records: Map<any, any> = new Map();
Run Code Online (Sandbox Code Playgroud)
assert(lexer.ts
):
scanCharacter(start: …
Run Code Online (Sandbox Code Playgroud) 我很惊讶,我无法找到一个答案,这无论是在谷歌还是在这里SO,但什么是比较一个最好的方式string
来Guid
考虑的情况下,和,如果合适的话,性能
const string sid = "XXXXX-...."; // This comes from a third party library
Guid gid = Guid.NewGuid(); // This comes from the db
if (gid.ToString().ToLower() == sid.ToLower())
if (gid == new Guid(sid))
// Something else?
Run Code Online (Sandbox Code Playgroud)
更新:
为了使这个问题更加引人注目,我换sid
一个const
......因为你不能有一个Guid const
,这是我处理的现实问题.
现在我ViewModel
看起来像这样:
public class MyViewModel
{
private readonly IMyService myService;
public ClaimantSearchViewModel(IMyService myService)
{
this.myService = myService;
}
}
Run Code Online (Sandbox Code Playgroud)
我的Controller
消费ViewModel
看起来像这样:
public class MyController : Controller
{
private readonly IMyService myService;
public HomeController(IMyService myService)
{
this.myService = myService;
}
public IActionResult Index()
{
var model = new MyViewModel(myService);
return View(model);
}
[HttpPost]
public async Task<IActionResult> Find()
{
var model = new MyViewModel(myService);
await TryUpdateModelAsync(model);
return View("Index", model);
}
}
Run Code Online (Sandbox Code Playgroud)
我需要的是我Controller
的样子是这样的:
public class MyController : …
Run Code Online (Sandbox Code Playgroud) c# dependency-injection autofac custom-model-binder asp.net-core-mvc
所以我觉得我已经走到了绳索的尽头,但希望有人比我在这里知道的更多。我有一些Typescript
文件,尽管这几乎无关紧要,因为我的所有内容文件都存在此问题。
通过在我的项目中使用它,我能够生成一个nuget
或更准确的dotnet pack
nuget 包,其中包含我的内容文件:.csproj
parent
<ItemGroup>
<Content Include="Scripts\Utility.ts">
<Pack>true</Pack>
<PackagePath>contentFiles\Scripts\;content\Scripts</PackagePath>
</Content>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
我可以浏览生成.nupkg
的文件,并看到该文件确实已添加到包中的content\Scripts
和contentFiles\Scripts
位置
问题是,每当我在我的“子”项目中使用这个包时,它Typescript
永远不会被复制到child
项目的任何文件夹中,尽管我可以看到它在.nuget\packages\parent\...
文件夹中被提取出来。
起初我认为这是我在parent
项目中的初始设置的问题,它可能是,但是在尝试了本书中的所有内容后,无法将内容文件复制到child
项目中。然后我尝试去尝试Init.ps1
在tools
我的包的文件夹中尝试使用的黑暗路径,虽然无法调试,但它似乎也偶尔运行(我完全卸载并重新安装了包,但它仍然无法运行大部分时间.) 这可能是方式,但我不知道为什么我不能把它输出到Package Manager Console
......也许还有希望,Init.ps1
但我似乎无法弄清楚。最后,我看到了nuget文件的一些潜力.targets
但我似乎也能掌握如何将它用于我的目的!我希望得到一些关于如何完成这项工作的反馈。
我作为主机MacOS 10.15 "Catalina"
安装。\n现在我想安装,所以我单击了,但收到此错误:VMWare Workstation Player
Windows 10
VMWare Tools
Player -> Manage -> Install VMware tools
我正在使用这个版本的播放器:
\nVMware\xc2\xae Workstation 15 Player\n15.5.2 build-15785246\n
Run Code Online (Sandbox Code Playgroud)\n 我有一个ASP.NET Core
有2页的网站,页面路由是通过MVC
,而不是Angular 2
.每个页面都有自己的Angular 2
"应用程序".我正在努力让这个与之合作webpack
.
如果我将两个组件引导到一个模块中,那么我会收到The selector "xxx" did not match any elements
错误.但是,如果我尝试entry
在webpack.config.js
那个polyfills
怪物中创建多个s,因为它无法找到其他模块.
我如何让它工作?这里唯一可用的选项是被迫使用Angular 2
路由器并创建一个SPA吗?
这是我的相关部分webpack.config.js
:
entry: {
"polyfills": "./App/polyfills.ts",
"vendor": "./App/vendor.ts",
"firstapp": "./App/bootfirst.ts",
"secondapp": "./App/bootsecond.ts"
},
resolve: {
extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html']
},
output: {
path: process.cwd() + "/wwwroot",
publicPath: "/js/",
filename: "js/[name].js"
},
Run Code Online (Sandbox Code Playgroud) angular ×4
c# ×4
.net-core ×1
asp.net-core ×1
autofac ×1
comparison ×1
guid ×1
linq ×1
nuget ×1
paypal ×1
string ×1
typescript ×1
webpack ×1