<div class="wrapper">
<div class="date">11.08.2017</div>
<h1>Заголовок</h1>
</div>
wrapper {
text-align: center;
}
<div ng-repeat="article in articles.values | filter:{title:paragraph}"></div>
<div ng-repeat="article in articles.values | filter:filterExpression"></div>
sc.filterExpression = article => article.title === paragraph;
public interface ISqlBuilder
{
SqlBuilder.Template AddTemplate(string sql, dynamic parameters = null);
ISqlBuilder LeftJoin(string sql, dynamic parameters = null);
ISqlBuilder PagingLeftJoin(string sql, dynamic parameters = null);
ISqlBuilder Where(string sql, dynamic parameters = null);
ISqlBuilder PagingWhere(string sql, dynamic parameters = null);
ISqlBuilder OrderBy(string sql, dynamic parameters = null);
ISqlBuilder PagingOrderBy(string sql);
ISqlBuilder Select(string sql, dynamic parameters = null);
ISqlBuilder AddParameters(dynamic parameters);
ISqlBuilder Join(string sql, dynamic parameters = null);
ISqlBuilder GroupBy(string sql, dynamic parameters = null);
ISqlBuilder Having(string sql, dynamic parameters = null);
}
using Dapper;
public class MyEntityQueryBuilder : IQueryBuilder<T>
where T: IEntity
{
private readonly ISqlBuilder _sqlBuilder;
private readonly SqlBuilder.Template _entityTemplate;
private readonly string entity_template = @"
select
/**select**/
from
entity_table e
/**leftjoin**/
/**where**/
/**orderby**/
";
private readonly string split_on = "Id";
public MyEntityQueryBuilder(ISqlBuilder sqlBuilder)
{
_sqlBuilder = sqlBuilder.AddTemplate(entity_template);
}
public Query Build(EntityFilter filter)
{
Select();
LeftJoin();
Where(filter);
Order();
return new Query
{
Sql = _entityTemplate.RawSql,
Parameters = _entityTemplate.Parameters,
SplitOn = split_on,
};
}
private void Select()
{
_builder.Select("e.Id");
_builder.Select("e.Title");
}
private void LeftJoin()
{
_builder.LeftJoin("asn_Responsibles r1 on r1.Id = e.MainResponsibleId");
_builder.LeftJoin("asn_EventResponsibles er on er.EventId = e.Id");
}
private void Where(EntityFilter filter)
{
_builder.Where("e.IsDeleted = 0");
if (filter == null)
{
return;
}
if (filter.Id.HasValue)
{
_builder.Where("e.Id = @id", new { id = filter.Id });
}
if (filter.IsRootOnly)
{
_builder.Where("e.ParentId is null");
}
}
private void Order()
{
_builder.OrderBy("e.CreateDate");
}
}
this.Bind<IRictagle>()
.To<Rictagle>()
.WithConstructorArgument("a", a)
.WithConstructorArgument("b", b);
abstract class NinjectProvider<T> : IProvider
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser'
@Pipe({ name: 'safeHtml' })
export class SafeHtmlPipe implements PipeTransform {
constructor(private sanitized: DomSanitizer) { }
transform(value: string) {
return this.sanitized.bypassSecurityTrustHtml(value);
}
}
<div [innerHTML]="data.content | safeHtml"></div>
export class CustomDataSource extends DataSource<T> {
constructor(
private _customService: CustomService,
private _paginator: MdPaginator) { }
connect(): Observable<T[]> {
const displayDataChanges = [
this._customService.getAllObjects(),
this._paginator.page
];
return Observable.merge(...displayDataChanges).map((data, page) => {
const clonedData = data.slice();
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
return data.splice(startIndex, this._paginator.pageSize);
})
}
disconnect() {}
}
angular.module('app', [], $rootScopeProvider => {
$rootScopeProvider.digestTtl(15);
});
myApp.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/detail');
$stateProvider
.state('root', {
url: '',
resolve: {
promiseDatas: function ($state, $http) {
return $http.get("params.json");
}
},
controller: function ($state, promiseDatas) {
var vm = this;
vm.datas = promiseDatas.data;
$state.current.data.datas = promiseDatas.data;
},
controllerAs: 'root'
data: {
datas: {}
}
})
.state('detail', {
parent: 'root',
url: '/detail/:id',
templateUrl: 'pages/detail.html',
resolve: {
promiseData: function ($state, $stateParams) {
return _.findWhere($state.current.data.datas, { id: $stateParams.id })
}
},
controller: function (promiseData) {
var vm = this;
vm.data = promiseData;
},
controllerAs: 'detail'
})
})
controller: function($state, $scope, $rootScope) {
$rootScope.$on("$stateChangeStart", function() {
$scope.stateParams = $state.params;
});
}