Last active
August 29, 2015 14:24
-
-
Save droyad/4fabdd1dc01e1691cba9 to your computer and use it in GitHub Desktop.
Angular mvc-partial
This file contains hidden or 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
| module Fams.EnumSelector { | |
| interface IScope extends ng.IScope | |
| { | |
| promise; | |
| loaded(); | |
| onLoad(); | |
| } | |
| function directiveFactory() { | |
| return { | |
| scope: { | |
| src: "@", | |
| onLoad: "&onLoad" | |
| }, | |
| template: "<div class='busy-block' cg-busy='promise'></div><ng-include src=\"src\" onload='loaded()'></ng-include>", | |
| controller: ($scope: IScope, $q) => { | |
| $scope.promise = $q.defer(); | |
| $scope.loaded = () => { | |
| $scope.onLoad(); | |
| $scope.promise.resolve(); | |
| }; | |
| } | |
| } | |
| } | |
| Fams.app.directive("mvcPartial", directiveFactory); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage, replace
@Html.Action("Foo", "Bar", new { @Area = "Bax", @Id= Model.Id })with<mvc-partial src="@Url.Action("Foo", "Bar", new { @Area = "Bax", @Id= Model.Id })"></mvc-partial>