无法通过nodejs,jade和nodeclipse从角度js获取值

时间:2015-03-03 22:36:12

标签: javascript eclipse angularjs node.js express

我是angular,nodejs和jade的初学者。我没有从nodeclipse(eclipse IDE)上的nodejs + jade获得角度js的值。我还注意到/myProject/public/javascripts/myCtrl.js的第1行,eclipse正在抱怨' angular is not defined'。以下是我的代码。

/myProject/views/layout.jade

doctype html
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
    script(src='/javascripts/lib/angular.min.js')
  body

    block content

/myProject/views/solutionTwo.jade

extends layout

block content
  div
    h1= title
    p Welcome here to #{title}

    div(ng-app="myapp1" ng-controller="myCtrl")
    {{ firstName + " " + lastName }}

script(src='/javascripts/myCtrl.js')   

/myProject/public/javascripts/myCtrl.js

1. var app = angular.module("myapp1", []);
2. 
3. app.controller("myCtrl", function($scope) {
4.    $scope.firstName = "John";
5.    $scope.lastName = "Doe";
6. });

1 个答案:

答案 0 :(得分:0)

您需要将表达式更改为 {{firstName}} {{lastName}}