search

Home  >  Q&A  >  body text

angular.js - Using the routing call interface of angularjs, it can be called from the controller, but the data cannot be obtained on the page.

My routing code

The called html interface is marked in red and the controller has been obtained again. When it is obtained on the html, there is no problem and the data can be displayed normally. After deleting the controller, the data cannot be obtained on the page, but my The controller can also load data normally

The following is my controller code

I now want to call the controller directly on the route instead of adding it to the html page. Is there any solution?

曾经蜡笔没有小新曾经蜡笔没有小新2811 days ago546

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-15 17:07:42

    LZ You should read the usage of Controller and Controller AS in the AngularJS documentation~

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-15 17:07:42

    state is configured as:

    {
        controller: '****Controller',
        controllerAs: 'vm'
    }

    Then delete ng-controller in your html.

    reply
    0
  • Cancelreply