我尝试了一个非常简单的例子:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body data-ng-app="MyApp">
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="js/libs/cordova.js"></script>
<script type="text/javascript" src="js/libs/angular.js"></script>
<script type="text/javascript" src="js/modules/app.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
你可以看到我inclueded cordova.js,angular.js和模块app.js.您可以使用依赖注入向模块添加角度服务,所以我尝试了以下方法:
var app = …Run Code Online (Sandbox Code Playgroud) 我有一个Spring Boot应用程序,该应用程序已经在线运行了几个月,直到今天没有任何问题。我有一个ID生成类型序列为Entity的实体:
@Entity
@ComponentScan
public class MyEntity {
/**
*
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long id;
}
Run Code Online (Sandbox Code Playgroud)
从今天开始,在创建和存储新实体时出现错误:
Unique index or primary key violation: "PRIMARY_KEY_D92 ON PUBLIC.MyEntity(ID) VALUES (3713, 250)"; SQL statement:
Run Code Online (Sandbox Code Playgroud)
每次发生此错误时,数据库中已经存在生成的ID(在这种情况下为3713)。那么,为什么突然间GenerationType.SEQUENCE生成了已经存在的ID?
编辑
我使用H2数据库版本1.4.191
我有带有继承的 kotlin 类:
abstract class Classification(
val accuracy: Double
)
Run Code Online (Sandbox Code Playgroud)
@Document
class OrderForm(
@Id
val id: String,
accuracy: Double,
val customerNumber: String,
val orders: List<Order>
) : Classification(accuracy)
Run Code Online (Sandbox Code Playgroud)
我实现了序列化测试:
internal class OrderFormTest : Logging {
private val objectMapper = ObjectMapper().registerKotlinModule()
@Test
fun canBeSerialisedToJsonAndBack() {
val expected = OrderForm(
"123_ID",
94.77,
"123_CUSTOMER",
listOf(
Order(
0.0,
OrderNumber(
10.0,
123456789L),
OrderSize(
99.99,
"38/40"),
OrderAmount(
100.0,
7),
OrderPrice(
50.0,
999.99),
OrderPage(
23.29343,
100)
),
Order(
0.0,
OrderNumber(
10.0,
123456789L),
OrderSize(
99.99,
"38/40"),
OrderAmount(
100.0, …Run Code Online (Sandbox Code Playgroud) 我尝试打开一个模态视图.为此,我使用以下内容:
crop: function(options) {
options = this.initOptions(options);
var scope = $rootScope.$new(true);
ionic.extend(scope, options);
scope.modal = $ionicModal.fromTemplate(template, {
scope: scope
});
// Show modal and initialize cropper.
return scope.modal.show().then(function() {
return (new jrCropController(scope)).promise.promise;
});
},
Run Code Online (Sandbox Code Playgroud)
这工作正常.但现在我不想在javascript中定义我的模板.我想在一个额外的html文件中定义我的模板,所以我做了.
所以我不得不取代这个:
$ionicModal.fromTemplate(template,
Run Code Online (Sandbox Code Playgroud)
有了这个:
$ionicModal.fromTemplateUrl(url,
Run Code Online (Sandbox Code Playgroud)
但现在我收到以下错误:
ionic.bundle.js:20306 TypeError: scope.modal.show is not a function
at Object.crop (jr-crop.js:287)
at Scope.$scope.crop (polaroids_edit.js:51)
at $parseFunctionCall (ionic.bundle.js:21044)
at ionic.bundle.js:53458
at Scope.$eval (ionic.bundle.js:23100)
at Scope.$apply (ionic.bundle.js:23199)
at HTMLButtonElement.<anonymous> (ionic.bundle.js:53457)
at HTMLButtonElement.eventHandler (ionic.bundle.js:11713)
at triggerMouseEvent (ionic.bundle.js:2863)
at tapClick (ionic.bundle.js:2852)
Run Code Online (Sandbox Code Playgroud)
当我使用模板网址而不是模板时,为什么会出现此错误?对我来说没有意义,因为在两种情况下它都是相同的方法.
angularjs ×2
javascript ×2
cordova ×1
hibernate ×1
ionic ×1
jackson ×1
jpa ×1
kotlin ×1
spring ×1
spring-boot ×1