Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-362

Allow controller-less views with some controller logic

    Details

    • Sprint:
      2014 Sprint 09 Tooling

      Description

      The ability to create views without a controller is quite nice, but it could be taken a step further. During development of a recent application I built numerous controllers with only 1 or 2 lines of code to set properties of elements in the view. For example:

      Index.js

      Alloy.createController("MyView", {
      	labelText: "Hello, World!",
      	imageUrl: "/images/test.png"
      }).getView();
      

      MyView.js

      $.MyLabel.text = arguments[0].labelText;
      $.MyImage.image = arguments[0].imageUrl;
      

      It would be nice if we could pass in parameters to the controller-less view which automatically sets these properties. For example:

      Index.js

      Alloy.createController("MyView", {
      	MyLabel: {
      		text: "Hello, World!"
      	},
      	MyImage: {
      		image: "/images/test.png"
      	}
      }).getView();
      

      This lets us omit the controller completely.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                skypanther Tim Poulsen
                Reporter:
                matthewcongrove Matthew Congrove
              • Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration