File tree Expand file tree Collapse file tree
Microsoft.AspNet.AngularServices/npm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /node_modules /
2+ /dist /
3+ /bundles /
Original file line number Diff line number Diff line change 1+ /src /
2+ /tsconfig.json
3+ /build.js
Original file line number Diff line number Diff line change 1+ // -------------
2+ // No need to invoke this directly. To run a build, execute:
3+ // npm run prepublish
4+ // -------------
5+
6+ var Builder = require ( 'systemjs-builder' ) ;
7+ var builder = new Builder ( './' ) ;
8+ builder . config ( {
9+ defaultJSExtensions : true ,
10+ paths : {
11+ 'angular2-aspnet' : 'dist/Exports' ,
12+ 'angular2-aspnet/*' : 'dist/*'
13+ } ,
14+ meta : {
15+ 'angular2/*' : { build : false }
16+ }
17+ } ) ;
18+
19+ var entryPoint = 'dist/Exports' ;
20+ var tasks = [
21+ builder . bundle ( entryPoint , './bundles/angular2-aspnet.js' ) ,
22+ builder . bundle ( entryPoint , './bundles/angular2-aspnet.min.js' , { minify : true } )
23+ ] ;
24+
25+ Promise . all ( tasks )
26+ . then ( function ( ) {
27+ console . log ( 'Build complete' ) ;
28+ } )
29+ . catch ( function ( err ) {
30+ console . error ( 'Build error' ) ;
31+ console . error ( err ) ;
32+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " angular2-aspnet" ,
3+ "version" : " 0.0.1" ,
4+ "description" : " Helpers for Angular 2 apps built on ASP.NET" ,
5+ "main" : " ./dist/Exports" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1" ,
8+ "prepublish" : " tsc && node build.js"
9+ },
10+ "repository" : {
11+ "type" : " git" ,
12+ "url" : " https://github.com/aspnet/NodeServices/tree/master/Microsoft.AspNet.AngularServices"
13+ },
14+ "typings" : " dist/Exports" ,
15+ "author" : " Microsoft" ,
16+ "license" : " Apache-2.0" ,
17+ "peerDependencies" : {
18+ "angular2" : " ^2.0.0-alpha.44"
19+ },
20+ "devDependencies" : {
21+ "systemjs-builder" : " ^0.14.11" ,
22+ "typescript" : " ^1.7.3"
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ export * from './Validation' ;
Original file line number Diff line number Diff line change 1+ import { ControlGroup } from 'angular2/angular2' ;
2+ import { Response } from 'angular2/http' ;
3+
4+ export class Validation {
5+
6+ public static showValidationErrors ( response : ValidationErrorResult | Response , controlGroup : ControlGroup ) : void {
7+ if ( response instanceof Response ) {
8+ var httpResponse = < Response > response ;
9+ response = < ValidationErrorResult > ( httpResponse . json ( ) ) ;
10+ }
11+
12+ // It's not yet clear whether this is a legitimate and supported use of the ng.ControlGroup API.
13+ // Need feedback from the Angular 2 team on whether there's a better way.
14+ var errors = < ValidationErrorResult > response ;
15+ Object . keys ( errors || { } ) . forEach ( key => {
16+ errors [ key ] . forEach ( errorMessage => {
17+ // This in particular is rough
18+ if ( ! controlGroup . controls [ key ] . errors ) {
19+ ( < any > controlGroup . controls [ key ] ) . _errors = { } ;
20+ }
21+
22+ controlGroup . controls [ key ] . errors [ errorMessage ] = true ;
23+ } ) ;
24+ } ) ;
25+ }
26+
27+ }
28+
29+ export interface ValidationErrorResult {
30+ [ propertyName : string ] : string [ ] ;
31+ }
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "module" : " commonjs" ,
4+ "target" : " es5" ,
5+ "sourceMap" : false ,
6+ "declaration" : true ,
7+ "noLib" : false ,
8+ "outDir" : " ./dist"
9+ },
10+ "exclude" : [
11+ " node_modules"
12+ ]
13+ }
You can’t perform that action at this time.
0 commit comments