我是单页应用程序、应用程序基础(F4A)和Angular.js的新手。这是我第一次尝试将Angular模块添加到框架中,虽然这看起来很简单,但有些东西不起作用。问题是html的角度部分显示在呈现的页面上。
{{ user.name || "empty" }}. 但是,对于来自F4A的指令,情况并非如此。它们在页面上不可见。我还没有编写控制器的代码,只是布置了html。此模块用于用户内联编辑页面,如配置文件,因此我不必有一个配置文件页面的数据输入和另一个显示。
帮助弄清楚这一点,我们将深表感谢!而且,我在网上找不到相关的指导,我也不是第一个把事情搞砸的人。
我正在遵循入门说明here。
1) Bower安装进行得很顺利,模块现在位于/bower-component/xeditable中。
2)我已经在index.html头中插入了建议的css链接。
3)我在头文件中插入了建议的js脚本,但也尝试了靠近Gulpfile顶部的地方,我认为它应该在那里:
// These files include Foundation for Apps and its dependencies
foundationJS: [
'bower_components/*', //add a bunch more like this.
//Angular-xeditable module
'bower_components/angular-xeditable/dist/js/xeditable.js'
],4)这个比特已经在Zurb的index.html的顶部:
<html ng-app="app">5)使用说明告诉我这样做:
var app = angular.module("app", ["xeditable"]);但是,我将其放在app.js的顶部:
(function() {
'use strict';
angular.module('pfApp', [
'ui.router',
'ngAnimate',
//foundation
'foundation',
'foundation.dynamicRouting',
'foundation.dynamicRouting.animations',
//angular-xeditable directive
'xeditable'
])6)第六步想把这段代码放在一个模板中,所以我把它放在一个已经有Angular {{ }}的模板中,这个模板不会引起问题:
<div ng-controller="Ctrl">
<a href="#" editable-text="user.name">{{ user.name || "empty" }}</a>
</div>7)最后,我将这个控制器复制到app.js中:
app.controller('Ctrl', function($scope) {
$scope.user = {
name: 'awesome user'
};
});发布于 2016-04-21 05:00:50
我在Upwork.com上找到了一个程序员,Natalya Ivanyak,他让它工作起来。我只展示了关键部分作为示例,而不是整个表单。
在projects-profile.html部分中:
<form editable-form name="addProjectForm" novalidate ng-controller="projectFormCtrl">
<div class="small-12 columns">
<a href="" ng-click="$form.$show()" e-placeholder="Describe the project in one or two short paragraphs." editable-textarea="project.description" e-name="description" e-rows="40" e-cols="40">
<pre class="textarea-field">{{project.description || 'Describe the project in one or two short paragraphs.'}}</pre>
</a>
</div>在controllers.js中:
angular.module('pfApp').controller('projectFormCtrl', ['$scope', '$filter', function($scope, $filter) {
$scope.project = {
pitch: '',
description: '',
whatEverElseYouWant: ''
};希望这对某些人有帮助!
https://stackoverflow.com/questions/35757691
复制相似问题