Step 15: Nested Views

介绍

Our panel content is getting more and more complex and now it is time to move the panel content to a separate view. With that approach, the application structure is much easier to understand, and the individual parts of the app can be reused.

1.练习效果

Step 15: Nested Views - 第1张  | 优通SAP

2.源码

You can view and download all files at Walkthrough – Step 15.

webapp/view/App.view.xml

Instead of putting the panel and its content directly into our App
view, we will move it to a new separate HelloPanel view. We refer to
this using an XMLView tag in the content aggregation of the panel.

3.webapp/view/HelloPanel.view.xml (New)

The whole content for the panel is now added to the new file
HelloPanel.view.xml. We also specify the controller for the view by
setting the controllerName attribute of the XML view.

4.webapp/controller/HelloPanel.controller.js (New)

To have a reusable asset, the method onShowHello is also moved from the
app controller to the HelloPanel controller.

5.webapp/controller/App.controller.js

We have now moved everything out of the app view and controller. The app controller
remains an empty stub for now, we will use it later to add more functionality.

留下一个回复

你的email不会被公开。

20 + 14 =