我有一些代码在元素上使用Polymer属性,例如:
<paper-drawer-panel force-narrow>
聚合物的工作方式是我不能简单地说force-narrow="false"如果我想要禁用该属性,它必须完全删除.Angular2中是否有办法有条件地删除整个属性?我似乎无法找到有关此主题的任何信息.我可以使用ngIf和重复使用和不使用属性的整个元素,但如果可能的话我宁愿不这样做.谢谢!
我有一些简单的代码(Angular2 + Polymer),paper-input用iron-icon一个suffix图标创建一个:
<paper-input type="text" [control]="email" label="Email">
<iron-icon suffix icon="mail"></iron-icon>
</paper-input>
Run Code Online (Sandbox Code Playgroud)
这是完整页面,请注意,实体化网格和行类是我带入项目的唯一实现类:
<div class="section">
<h1 class="paper-font-headline">Admin Registration</h1>
<div class="row">
<div class="col s12 m6 6">
<p class="paper-font-body2">some stuff here</p>
</div>
<div class="col s12 m6 6">
<paper-card class="stretch">
<div class="sub-section">
<form>
<paper-input type="text"
[control]="email"
label="Email">
<iron-icon suffix icon="mail"></iron-icon>
</paper-input>
</form>
</div>
</paper-card>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这在页面加载上看起来很不错:
但是,当我离开页面并返回时,图标会低于输入:
在html中,您可以清楚地看到图标paper-input-container位于导航之外.
谁看过这个吗?我很茫然.需要注意的一点是,只有webcomponents-lite.js在我的index.html文件中使用时才会发生这种情况.webcomponents.js使用时有其他问题(不应该使用),但这不是其中之一.这是Polymer 1.0.谢谢!
编辑:
这不是 Chrome中的问题,而是在其他主流浏览器中.
以下是我的进口,以防相关:
<!-- 1. Load libraries --> …Run Code Online (Sandbox Code Playgroud) 这是存在问题的JPanel类:
public class EntryDialog extends JPanel{
private static final long serialVersionUID = 1L;
MainWindow mainWindow;
Image background;
JButton continueresume;
JButton newresume;
JButton settings;
JButton exit;
public EntryDialog(MainWindow mainWindow){
continueresume = new JButton("Continue resume");
newresume = new JButton("New resume");
settings = new JButton("Settings");
exit = new JButton("Exit");
this.mainWindow = mainWindow;
this.background = Utilities.getImage("images\\entryDialogBackground.jpg", true);
this.setLayout(null);
//continueresume button
continueresume.setBounds(Utilities.getScaledWidth(1150),
Utilities.getScaledHeight(150),
Utilities.getScaledWidth(500),
Utilities.getScaledHeight(50));
//newresume button
newresume.setBounds(Utilities.getScaledWidth(1150),
Utilities.getScaledHeight(220),
Utilities.getScaledWidth(500),
Utilities.getScaledHeight(50));
//settings button
settings.setBounds(Utilities.getScaledWidth(1150),
Utilities.getScaledHeight(290),
Utilities.getScaledWidth(500),
Utilities.getScaledHeight(50));
//exit button
exit.setBounds(Utilities.getScaledWidth(1150),
Utilities.getScaledHeight(360),
Utilities.getScaledWidth(500),
Utilities.getScaledHeight(50));
this.add(continueresume);
this.add(newresume); …Run Code Online (Sandbox Code Playgroud) 我有 jQuery 代码调用这样的函数:
$('#text_area').bind('input propertychange', function() {...
Run Code Online (Sandbox Code Playgroud)
绑定到该函数的元素是文本区域。当我键入并删除文本时,该函数会被调用,但是当我通过热键或拖动鼠标选择所有文本,然后按退格键时,该函数不会被调用。这是我无法调用函数的唯一实例。这是这次活动的预期吗'input propertychange'?如果是这样,我该如何改变它以按预期工作?请注意,这适用于 Chrome、IE 和 Firefox。
我有一个SSIS包,它从SQL Server导入数据并将其放入Excel目标文件中。当进入ADO Source组件的高级编辑器时,我有一个字段Description,其外部数据类型为Unicode String,长度为4000,输出数据类型为Unicode Text Stream(这是为了确保String可以将长度> 255的值导入Excel)。现在,当我进入Excel Destination组件的“高级编辑器”时,“数据类型”将停留为Unicode String,长度为4000。它允许我进行更改,但单击“保存”后会立即还原。运行中的故障,因为我已经在数据包的结果Description字段长度> 255找遍了关于这个问题无数线程如本但尚未解决。任何帮助将不胜感激。
我正在尝试在我的MVC .NET CORE应用程序中创建一个页面,用户可以在其中更改其他用户的角色.此时视图和模型绑定都很有效,但是当实际尝试将角色保存回数据库时,我收到一条错误消息,指出角色不存在.我的方法是:
我在控制器中的代码如下:
var user = await _userManager.FindByIdAsync(id);
if (user == null)
{
return View("Error");
}
using (_context.Database.BeginTransaction())
{
var removeResult = await _userManager.RemoveFromRolesAsync(user, await _userManager.GetRolesAsync(user));
if (!removeResult.Succeeded)
{
return View("Error");
}
var addResult = await _userManager.AddToRolesAsync(user, model.MemberRoles);
if (!addResult.Succeeded)
{
return View("Error");
}
}
Run Code Online (Sandbox Code Playgroud)
当model.MemberRoles作为一个List<string>角色.奇怪的是_userManager.RemoveFromRolesAsync,即使我将用户的现有角色直接传递给函数,此过程也会失败.我试过放弃UserManager课程并与ef一起去,但没有运气.我还验证了模型中的角色与数据库中的角色匹配.是否有任何明显错误会导致失败?谢谢.
编辑
这是我遇到的错误:
InvalidOperationException: Role ADMINISTRATOR does not exist.
Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`4.<AddToRoleAsync>d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown …Run Code Online (Sandbox Code Playgroud) 我目前正在PHPStorm中编写一个项目,并且编辑器解决了以服务器文档根为前缀的路径问题.这方面的一个例子可能是:
require_once($_SERVER["DOCUMENT_ROOT"] . "/file.php");
Run Code Online (Sandbox Code Playgroud)
这将在服务器上进行评估,并且页面构建正确.然而,PHPStorm抱怨并说"未找到路径'file.php'".我在网上调查了这个问题,并发现线程如这是大纲这种情况.我已经尝试按照建议设置资源根但没有运气.任何帮助或指导,为什么会发生这种情况将不胜感激.谢谢!
编辑:文档根目录评估我的笔记本电脑上的本地驱动器,我用于在本地Apache实例上调试 - "/ Users/Me/PhpstormProjects/MyProject".此路径也设置为PHPStorm中的资源根.
我有几个外部JavaScript文件,需要从php中检索从MySQL检索的变量.他们当前访问的方式是通过隐藏的输入标记,例如:
<input type="hidden" id="myVar" value="<?php echo($myVar); ?>">
Run Code Online (Sandbox Code Playgroud)
在JavaScript中,我可以非常轻松地访问php变量$myVar.
做一些研究我发现在表单之外隐藏输入标签是完全有效的,所以我不明白为什么这种方法可能有缺陷.我知道使用ajax是另一种解决方案,但看起来很傻,因为这个页面是动态构建的,为什么要再次访问数据库呢?尖叫"不要这样做"这种方法有什么问题吗?我是JavaScript新手,对HTML也是如此,所以任何建议都值得赞赏.
我有一段代码,使用一个名为的视图检查用户是否在我们的数据库中RESOURCE_V.如果没有,代码使用Entity Framework使用Active Directory中的用户信息将用户添加到数据库.然后,我想重新查询RESOURCE_V视图以获取提交的信息.这样做我得到"对象引用未设置为对象的实例.".这是完整的代码:
HALEntities context = new HALEntities();
List<RESOURCE_V> userData = (from i in context.RESOURCE_V
where i.NT_USER_N == Environment.UserName
select i).ToList();
// add user to RSRC table using Active Directory details
if (userData.Count > 0)
{
PrincipalContext principleContext = new PrincipalContext(ContextType.Domain, HAL_Globals.domain);
UserPrincipal user = UserPrincipal.FindByIdentity(principleContext, IdentityType.SamAccountName, HAL_Globals.domain + "\\" + Environment.UserName);
RSRC rsrc = new RSRC();
rsrc.RSRC_I = context.RSRCs.Select(u => u.RSRC_I).Max() + 1;
rsrc.NT_USER_N = user.SamAccountName + "AAAA";
rsrc.FRST_N = user.GivenName;
rsrc.LAST_N = user.Surname;
rsrc.INIL_N …Run Code Online (Sandbox Code Playgroud) 我绑定ItemsSource的属性DataGrid在我的ViewModel的属性。然后我创建一个ICollectionView并使用DataGrid的项目源创建一个默认视图,如下所示:
_displayItemsView = CollectionViewSource.GetDefaultView(_displayItems);
其中_displayItems是 aList并且_displayItemsView是ICollectionView。
现在我遇到的问题是我允许用户像这样过滤数据网格:
_displayItemsView.Filter = delegate(object item)
{
DISPLAY_ITEM displayItem = (DISPLAY_ITEM)item;
if ((displayItem.RETAIL_ITEM_DPCI.ToString().ToUpper().Contains(value.ToUpper()))
.
.
.
Run Code Online (Sandbox Code Playgroud)
这在大多数情况下都很好用,但是如果用户当前正在编辑或DataGrid在ICollectionView. 我应该如何检测:
DataGrid目前正在修改或ICollectionView不在状态,被过滤?感谢任何指导,我对想法持开放态度。谢谢!