Ejemplo n.º 1
0
        public static void PhoneListCtrlFn(
            [Name("$scope")] PhoneListScopeModel scope,
            PhoneQueryModel phoneService) // this MUST match the service name
        {
            scope.Phones = phoneService.Query();

            scope.OrderProp = "age";
        }
Ejemplo n.º 2
0
        public static void PhoneDetailCtrlFn(
            [Name("$scope")] PhoneDetailsScopeModel scope,
            [Name("$routeParams")] PhoneModel routeParams,
            PhoneQueryModel phoneService) // this MUST match the service name
        {
            scope.Phone = phoneService.Get(
                new { Id = routeParams.Id },
                (phone) =>
            {
                scope.MainImageUrl = phone.Images[0];
            }
                );

            scope.SetImage = (imageUrl) =>
            {
                scope.MainImageUrl = imageUrl;
            };
        }
Ejemplo n.º 3
0
        // this MUST match the service name
        /*
         * This illustrates how the same controller would be used when passing
         * function reference only (see controllers.cs)
         *

        public static void PhoneListCtrlFn(
            [Name("$scope")] PhoneListScopeModel scope,
            PhoneQueryModel phoneService) // this MUST match the service name
        {
            scope.Phones = phoneService.Query();
            scope.OrderProp = "age";
        }
        */
        public static void PhoneDetailCtrlFn(
            [Name("$scope")] PhoneDetailsScopeModel scope,
            [Name("$routeParams")] PhoneModel routeParams,
            PhoneQueryModel phoneService)
        {
            scope.Phone = phoneService.Get(
                new
                {
                    Id = routeParams.Id
                },
                (phone) =>
                {
                    scope.MainImageUrl = phone.Images[0];
                }
            );

            scope.SetImage = (imageUrl) =>
            {
                scope.MainImageUrl = imageUrl;
            };
        }
Ejemplo n.º 4
0
        // this MUST match the service name
        public static void PhoneListCtrlFn(
            [Name("$scope")] PhoneListScopeModel scope,
            PhoneQueryModel phoneService)
        {
            scope.Phones = phoneService.Query();

            scope.OrderProp = "age";
        }