-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new DI ContentRef and also dom codes
- Loading branch information
Showing
12 changed files
with
141 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Pipe({ | ||
name: 'sizeToUnit' | ||
}) | ||
export function SizeToUnitPipe(){ | ||
this.compile = function(size){ | ||
var t = Math.floor(Math.log(size, 1024)); | ||
var unit = ['b', 'kb', 'mb', 'gb', 'tb', 'pb']; | ||
return Math.round(size / Math.pow(1024, t), 2) + ' ' + unit[t]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,20 @@ | ||
import { ViewIntentService } from '../services/intent.service'; | ||
Directive({ | ||
selector: 'open', | ||
DI: ['ElementRef?', ViewIntentService], | ||
props: ['open', "params"], | ||
events: ['event:click=clickHandler()'] | ||
selector: 'openIntent', | ||
DI: [ViewIntentService], | ||
props: ['open=openIntent', "params"], | ||
events: ['click:event=clickHandler()'] | ||
}) | ||
|
||
/** | ||
* | ||
* @param {*} ElementRef | ||
* @param {*} viewIntent | ||
*/ | ||
export function OpenIntent(elementRef, viewIntent) { | ||
export function OpenIntent( viewIntent) { | ||
this.params = {}; | ||
this._open = null; | ||
this.open = null; | ||
|
||
this.clickHandler = function() { | ||
// state has changed | ||
//where attr contains a parameter | ||
if (this.splitWhere.length) { | ||
//convert the required string to OBJECT | ||
this.params = elementRef.context.evaluate(this.splitWhere.join(':')); | ||
} | ||
viewIntent.openIntent(this.pathName, this.params); | ||
viewIntent.openIntent(this.open, this.params); | ||
}; | ||
|
||
Object.defineProperty(this, 'open', { | ||
set: function(value) { | ||
this.splitWhere = (value || '').split(':'); | ||
this.pathName = this.splitWhere.shift(); | ||
this._open = value; | ||
}, | ||
get: function() { | ||
return this._open; | ||
} | ||
}); | ||
} |
Oops, something went wrong.