Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

can't create <a> in angular

Hi,

I've finished the angularJS course and now I'm trying to create my portfolio site in angular just for practice. I got a problem when create the portfolio page cause I can't make my <li> elements into links for my projects, no matter what I do.

I've tried: <a href=""> <a ng-href=""> <li ng-href=""> And much much more..

When I inspect the page there is no sign of any links.

index.html:

<!DOCTYPE html>

<html>

<head>
    <title>Home</title>
    <meta charset="utf-8">
    <base href="/">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/main.css">
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-route.js"></script>
</head>


<body ng-app="portfolioApp">

    <div class="wrapper">

        <navbar></navbar>
        <ng-view></ng-view>

    </div>

    <footers></footers>

    <script src="js/app.js" type="text/javascript"></script>
    <script src="js/directives/navbar.js" type="text/javascript"></script>
    <script src="js/directives/footers.js" type="text/javascript"></script>

</body>

</html>

portfolio.html (template):

<div class="portfolio">
    <h2>My projects</h2>
    <ul>
        <li class="project"><img src="img/random_quote.png">
            <h4 class="project-name">RandomQuote</h4></li>
        <li class="project"><img src="img/weather.png">
            <h4 class="project-name">Weather-App</h4></li>
        <li class="project"><img src="img/wikipedia.png">
            <h4 class="project-name">WikipediaViewer</h4></li>
        <li class="project"><img src="img/rps.png">
            <h4 class="project-name">Rock, Paper, Scissors</h4></li>
    </ul>
</div>

**app.js + routes:

var app = angular.module("portfolioApp", ["ngRoute"]);
app.config(function($routeProvider, $locationProvider) {

    $routeProvider.when("/", {

        templateUrl: "templates/introduction.html"

    }).when("/portfolio", {

        templateUrl: "templates/portfolio.html"

    }).when("/about", {

        templateUrl: "templates/about.html"

    }).otherwise({

        redirectTo: "/"

    });

    $locationProvider.html5Mode(true);

});

I really hope someone got an idea how to fix this cause I'm losing it really soon :-P

Btw, I'm not added any controllers for now but I don't think that's why I can't get the links working / showing up..

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

UPDATE: I can create <a href="http://google.com"> inside my template but I can't create <a href="http://www.codepen.io/username/view/pencode">

Any idea why?