Skip to content

Instantly share code, notes, and snippets.

@droyad
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save droyad/4fabdd1dc01e1691cba9 to your computer and use it in GitHub Desktop.

Select an option

Save droyad/4fabdd1dc01e1691cba9 to your computer and use it in GitHub Desktop.
Angular mvc-partial
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);
}
@droyad
Copy link
Author

droyad commented Jul 2, 2015

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment