角度路由没有达到它的路线

时间:2017-11-05 04:08:43

标签: angularjs angular-ui-router

这里我是angularjs的新手,请帮助我,为什么我无法点击我的路由。问题是,当我点击联系人链接时,它没有触发curl "http://mirror.csclub.uwaterloo.ca/eclipse/technology/epp/downloads/release/oxygen/1a/eclipse-java-oxygen-1a-macosx-cocoa-x86_64.dmg" -o /tmp/TeamWikiInstallation/eclipse.dmg echo '> Attaching' hdiutil attach -quiet /tmp/TeamWikiInstallation/eclipse.dmg echo '> Copying' cp -R '/Volumes/Eclipse/Eclipse.app' ~/Applications/ echo '> Detaching' ECLIPSE_DRIVE="$(diskutil info '/Volumes/Eclipse/' | awk '/Device Node/ {print $3}')" hdiutil detach -quiet $ECLIPSE_DRIVE ~/Applications/Eclipse.app/Contents/MacOS/eclipse -clean -data $HOME/eclipse-workspace/ -purgeHistory -application org.eclipse.equinox.p2.director -noSplash -repository http://first.wpi.edu/FRC/roborio/release/eclipse/ -installIUs edu.wpi.first.wpilib.plugins.java.feature.feature.group 功能。

.when

HTML

var app = angular.module('MyApp', ['ngRoute'])

    app.config(function ($routeProvider, $locationProvider) {
        $routeProvider
        .when('/Contact', {
            templateUrl: '/ApiClient/Contact/AdminContact.html',
            controller:'ContactCtrl'
        })

        $locationProvider.html5Mode({
            enabled: true,
            requireBase: false,
            hashPrefix:''
        });
    })

2 个答案:

答案 0 :(得分:0)

应该是

<a href="#!Contact">Contact</a>

<a href="#!/Contact">Contact</a>

答案 1 :(得分:0)

你可以试试这个。

<p><a href="#/!">Main</a></p>

<a href="#!Contact">Contact</a> // Actually you put #!/Contact instead of #!Contact

<div ng-view></div>

var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
    $routeProvider
    .when("/", {
        templateUrl : "main.htm"
    })
    .when("/Contact", {
        templateUrl: '/ApiClient/Contact/AdminContact.html',
        controller:'ContactCtrl'
    });
});