你会如何使用grunt-contrib-clean来否定特定文件夹的清理.否定比赛似乎不起作用.
clean: {
plugins: [
'app/plugins/myplugin',
'!app/plugins/myplugin/assets'
]
}
Run Code Online (Sandbox Code Playgroud)
我尝试了几种不同的否定模式,例如:
'!app/plugins/myplugin/assets'
'!app/plugins/myplugin/assets/**'
Run Code Online (Sandbox Code Playgroud)
以及在重要的情况下反转阵列中的位置.似乎无法保持clean上的资产文件夹/内容.assets文件夹包含jQuery,AngularJS和内置的Bootstrap(SASS),我不想继续复制/构建,这似乎是浪费时间.
我正在尝试验证使用指令生成的动态表单输入并隔离范围.在指令之外我有主要形式,在ng-repeat中我试图使用ng-form,但它不会显示错误消息.最初我在ng-repeat上有ng-form,但是认为这不起作用,因为它超出了指令的范围,所以把它放在指令的父div上,但仍然没有显示无效电子邮件的验证.
具有ng-repeat和field指令的表单
<form name="mainForm"
role="form"
ng-controller="WizardFormController as wizFormCtrl"
ng-submit="submit( mainForm.$valid )"
novalidate>
<div ng-repeat="field in panel.form_fields">
<form-field field="field"
model="models[field.field_name]" ng-form="subForm">
</form-field>
</div>
<div class="form-group clearfix">
<button class="btn btn-primary pull-right"
ng-click="update( models )"
ng-disabled="mainForm.$invalid">Save Progress</button>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
表格字段指令
<div class="form-group" ng-form="subForm">
<label for="{{field.field_name}}">{{field.field_label}}</label>
<input type="text"
class="form-control"
id="{{field.field_id}}"
name="{{field.field_name}}"
ng-model="model">
<div ng-show="subForm[field.field_name].$dirty &&
subForm[field.field_name].$invalid">Invalid:
<span ng-show="subForm[field.field_name].$error.email">This is not a valid email.</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
看起来它应该工作查看生成的标记,指示该字段是ng-valid:
<div class="form-group ng-scope ng-dirty ng-valid-required ng-valid ng-valid-email"
ng-form="subForm">
Run Code Online (Sandbox Code Playgroud)
这只是我访问subForm的方式:
subForm[field.field_name].$dirty
Run Code Online (Sandbox Code Playgroud)
更新 我找到了解决这个问题并在下面回答,请看这里
我有地区(城市列表),租赁(租赁信息列表)和Rental_Location(租赁地址列表+纬度/长)的数据库表.
基本关系是:
Regions haveMany Rentals (with FK's region_id and rental_location_id in Rentals table)
Locations haveMany Rentals, or the reverse logic Rental belongsTo a Location
Run Code Online (Sandbox Code Playgroud)
我想要做的是从region_id(来自租赁表)获取区域中所有租赁的位置信息,以及包括位置空间数据(rental_locations表):
$region = Region::find(1);
$rentals = $region->rentals; // doesn't contain location information yet
$rentalDataWithSpatialLocationData = $region->rentals->location; // what I liked to do
Run Code Online (Sandbox Code Playgroud)
但是使用belongsTo关系的最后一行将无法通过将rental_locations中的空间数据添加到原始租赁集合中.
现在$ rental集合包含一个区域的所有租赁,但没有空间数据来标记地图上的位置,但除了在QueryBuilder中使用如下所示的连接而不在我的模型中使用ORM hasMany属性:
$spatials = DB::table('rentals')
->join('regions', 'rentals.region_id', '=', 'regions.id')
->join('rental_locations', 'rentals.rental_location_id', '=', 'rental_locations.id')
->where('rentals.region_id', '=', $region_id)
->select('*')
->get();
Run Code Online (Sandbox Code Playgroud)
基本上,我无法弄清楚如何使用其位置信息获取所有租赁的集合,这是否可以使用ORM?看起来这样比连接可能会变得昂贵,所以我现在假设您不使用ORM来排除QueryBuilder,而只是补充简单和快速的关系查询?
我可以在 Chrome 中使用 AngularJS 下载 PDF,但这似乎不适用于最新的 FireFox、Internet Explorer 11 或 Edge(假设它也不适用于 IE10),而且我知道IE9 需要垫片。如果有人有意见,不知道这是否是最好的垫片,但目前它似乎不起作用。我有一个应答式的试了一下blob,并arraybuffer只是在做一个差的情况下,它没有。
所有这些都与caniuse指示的使用 Blob URL相悖。任何人都可以在 IE9 及更高版本以及 FF 的最后几个版本中使用它,并且可以指出我做错了什么?
$http({
url: '/api/v1/download',
method: 'GET',
responseType: 'blob' // or 'arraybuffer'
}).then(function (response) {
// Use the Blob object to create an object URL to download the file
var url = URL.createObjectURL(response.data);
// var url = URL.createObjectURL(new Blob([response], {type: 'application/pdf'})); // arraybuffer version
// Create an anchor to perform download, but …Run Code Online (Sandbox Code Playgroud) 我一直在玩Grunt,其中一个我想用它来编译我的LESS文件,但由于某种原因扩展:true(我从底部向上评论了所有内容,它在评论后停止抛出错误在less中:mini任务导致此错误:警告:对象true没有方法'indexOf'使用--force继续.有谁知道为什么会这样?我可以在grunt-contrib-copy中动态构建文件对象没问题,并且需要展开才能使其他选项工作.
less: { // Set up to detect files dynamically versus statically
mini: {
options: {
cleancss: true, // minify
report: 'min' // minification results
},
files: {
expand: true, // set to true to enable options following options:
cwd: "dev/less/", // all sources relative to this path
src: "*.less", // source folder patterns to match, relative to cwd
dest: "dev/css/", // destination folder path prefix
ext: ".css", // replace any existing extension with this value in dest folder
flatten: …Run Code Online (Sandbox Code Playgroud) 我正在按照文档来播种users表,该表显示正在使用的User :: create
class UserTableSeeder extends Seeder {
public function run()
{
DB::table('users')->delete();
User::create([
'username' => 'test',
'firstname' => 'Test',
'lastname' => 'Test',
'email' => 'test@domain.com',
'password' => Hash::make('test'),
'role' => 'user'
]);
}
}
Run Code Online (Sandbox Code Playgroud)
但它一直说:
PHP Fatal error: Class 'User' not found in /home/vagrant/projects/roopla/database/seeds/UserTableSeeder.php on line 17
Run Code Online (Sandbox Code Playgroud)
我想也许我需要制作:使用artisan for User的模型,但它已经存在.任何人都可以指出我正确的方向我只是开始与Laravel并通过Laracast和文档拼凑在一起,但没有Laracast播种5.0.现在看来你不能生成种子,因为工匠不认识生成:种子
使用el = de.query(By.css('h2')).nativeElement;本机元素API 是否有任何优势el = de.nativeElement.querySelector('h2');?它们提供相同的结果。
刚从Angular 4单元测试开始,想知道是否存在任何性能差异,或者由于它们完成相同的工作而需要在其他方面使用的理由。我不确定我了解使用By.css(...)的便利性,或者您可能会在哪种情况/原因下使用另一种方法。
我找到了一个可以“全选”的例子:https : //ng-select.github.io/ng-select#/multiselect-checkbox
但是,我收到一个错误:Cannot read property 'selected' of undefined. 我想知道为什么我会收到这个错误,以及如何在 Angular 5 中使用 ng-select 实现“全选”。
谢谢
使用ComponentFactoryResolver动态创建组件很简单,但是当我尝试<mat-error>在<mat-form-field>. 我一直在使用 Netanel Basal 的示例和 Bootstrap 组件,它非常适合生成表单控制错误,但由于 Angular Material 中使用的内容投影,<mat-error>我似乎无法让它适用于 Angular Material v8.2.1。
是否可以<mat-error>在 a 中动态创建a<mat-form-field>并使其内容项目正确?
在这个应用程序中,我已经引入并设置了 Serilog,它适用于异常,并且我想将 Microsoft 的 Logger 与 Serilog 一起使用,但我似乎无法弄清楚如何在没有此错误的情况下将其 DI 到服务中 dotnet build.
我不确定我缺少什么让 ILogger 使用 Serilog 的实例?
错误dotnet build:
[13:56:21 FTL] Host terminated unexpectedly
System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'App.Services.MyService'.)
Run Code Online (Sandbox Code Playgroud)
服务依赖注入:
[13:56:21 FTL] Host terminated unexpectedly
System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Unable to resolve …Run Code Online (Sandbox Code Playgroud) angular ×3
javascript ×3
angularjs ×2
gruntjs ×2
laravel ×2
laravel-5 ×2
php ×2
.net-core ×1
asp.net-core ×1
c# ×1
css ×1
eloquent ×1
forms ×1
jquery ×1
less ×1
multi-select ×1
mysql ×1
namespaces ×1
node.js ×1
serilog ×1
unit-testing ×1
validation ×1