0

Below is my project structure:

-modules
  --> mymodule
     -->controllers
     -->services
     -->views
     -->mymod.js
-app-route.js
-index.html

where

mymod.js:

'use strict';
angular.module('mymodule',[
   'myController.controllers',
   'myController.services'
]);

and app-route.js:

var myApp = angular.module('myApp', ['ngRoute', 'ui.router' ,'ngCookies', 'myModule', 'homeModule', 'app-custom-filters'
    ,'interceptor-ctrl', 'config'
    ]);

$urlRouterProvider.otherwise('/login');

        $stateProvider

            .state("addition", {
                url: "/addition",
                templateUrl: 'modules/views/show.html',
                controller: 'demoCtrl'
            })

Now what I want is:

  1. I want to add a link in index.html like below

<li> <a href="/#/demourl"> <span>Link Test</span></a> </li>

and on clicking Link Test some operation will be done and shown on a html page view.html (present in views folder.)

I am confused how to do this step wise, I want to follow the structure defined above.

Please ask or edit the question if needed, I am already messed.

4

1 回答 1

0

添加新状态demourl

$stateProvider

            .state("addition", {
                url: "/addition",
                templateUrl: 'modules/views/show.html',
                controller: 'demoCtrl'
            })
            .state("demourl", {
                url: "/demourl",
                templateUrl: 'modules/views/view.html',
                controller: 'viewCtrl'
            });

在 index.html 中,

<li> <a ui-sref="demourl"> <span>Link Test</span></a> </li>

ui-sref="demourl"它将用户重定向到demourl状态。

demourlstate 将显示 view.html

请参阅此链接以获取更多详细信息

于 2016-06-01T12:36:45.233 回答